Saving and Storage

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.

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

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

@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.