Discord
Login
Community
DARK THEME

How do I correctly save variables?

I was making an idle game and in order for it to actually be “idle” I need to save the value of each material. I made a new project to figure out how to do this correctly, but I am having some trouble saving the value of the variable each second. Any suggestions would be helpful. Also does anyone now how to use markdown on mobile. Here’s my code so far:

`

init = function()

textInc = 0

end

update = function()

textInc += 1

if textInc == 60 then

test.textIncrement()

textInc = 0

end

end

test = class

text = 5

textIncrement = function()

text += 1

textInc = 0

storage.set(test.text, test.text))

end

end

draw = function()

screen.clear()

screen.drawText(test.text, 0, 0, 50, "255")

screen.fillRect(0, 80, 80, 20, "255")

end `

I genuinely don’t know how I just used markdown.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community