Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Saving and Storage

edited August 2014 in Code Sharing Posts: 167

Here is a small example of somthing that can save your score:


function setup()
  score = 0

function draw()
    background(127, 127, 127, 255)
    score = readLocalData("score", 0)
    fill(0, 0, 0, 255)
text("Score: " ..score, 500, 500)
score = score + 1
saveLocalData("score", score)
text("Move your finger to clear the score", 200, 300)

function touched(t)
    if t.state == MOVING then


  • The user and all related content has been deleted.
  • Posts: 1,976

    You might want to put the readLocalStorage in setup, it only needs to be called once.

  • Posts: 167

    And i created this in like 5 mins because I figured some beginners might have needed help

  • Posts: 178

    @code_maker. The tutorials in Codea already do a great job of explaining it already. Also, I would suggest you don't add code to clear all of the data if you just wanted to remove one variable's value.

Sign In or Register to comment.