You can use the following commands to save and load values permanently:
saveLocalData( "highscore", 1234 )
score = readLocalData( "highscore" )
Look at the documentation under “Storage” for more info.
Thanks. Was also wondering: Can you use the function close() after a certain amount of time? For example, have it print something, wait say 20 seconds and then close()?
You can do that:
function setup()
print("Something")
end
function draw()
if ElapsedTime > 20 then
close()
end
end
Or (if he wanna do something before):
function setup()
stuff = true
currentSecond = 0
end
function draw()
If elapsedTime > currentSecond then
currentSecond = currentSecond +1
End
if heroIsDead then
print("ouhhh....")
setSecond = currentSecond
if setSecond > 19 then
close()
end
end
end