– If I wanted to save the “highscore” and read it later, how would I do that exactly?
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
-- Parameters
watch('highscore')
-- Positioning
x = WIDTH/2
y = HEIGHT/2
-- Colour value
c = color(255, 255, 0, 255)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
ellipse(x, y, 100)
fill(c)
end
function touched(touch)
x = touch.x
y = touch.y
if touch.state == BEGAN then
highscore = highscore + 1
end
end
-- If I wanted to save the "highscore" and read it later, how would I do that exactly?
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
-- Parameters
highscore = readLocalData("highscore")
watch('highscore')
-- Positioning
x = WIDTH/2
y = HEIGHT/2
-- Colour value
c = color(255, 255, 0, 255)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
ellipse(x, y, 100)
fill(c)
end
function touched(touch)
x = touch.x
y = touch.y
if touch.state == BEGAN then
highscore = highscore + 1
saveLocalData("highscore",highscore)
end
end
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
-- Parameters
watch('highscore')
-- Positioning
x = WIDTH/2
y = HEIGHT/2
-- Colour value
c = color(255, 255, 0, 255)
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
ellipse(x, y, 100)
fill(c)
end
function touched(touch)
x = touch.x
y = touch.y
if touch.state == BEGAN then
highscore = highscore + 1
end
end