Wiki
Clone wikiCore / kidtouch
After learning how to watch Spritey our code was like this:
-- Use this function to perform your initial setup
function setup()
spx = 100 -- Spritey x
spy = 100 -- Spritey y
print("Hello World!")
print("Look at me go!")
parameter.watch("spx")
parameter.watch("spy")
end
-- This function gets called once every frame
function draw()
-- This sets the background color to black
background(0, 0, 0)
-- Do your drawing here
sprite("SpaceCute:Background",374,374)
spx = spx + 1
spy = spy + 1
tint(0, 255, 0, 255)
sprite("Planet Cute:Character Boy",spx,spy,101/2,171/2)
end
Now add this after the very end
sprite("Planet Cute:Character Boy",spx,spy,101/2,171/2)
end
function touched(touch)
spx = touch.x
spy = touch.y
end
Now play. When you touch the screen, Spritey will move to right where you touched.
Time to teach Spritey about gravity
Updated