so I’m having a bit of trouble locking the x Axis so that when you control the player you can only move it up and down.
here is my code so far that makes it move all over the scene:
function setup()
-- Use Sprite Editor to import photos from your library (tap the highlighted text below)
img = readImage("Documents:bg", WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
player = readImage("SpaceCute:Rocketship")
end
function draw()
-- spriteMode is CENTER by default
sprite("Documents:bg", WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
-- you could use the image path directly, but loading it into a variable is better.
-- sprite("Documents:myImportedPhoto", WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
-- Draw ground
for i = 1,12 do
sprite("Planet Cute:Ramp South", -WIDTH/18 -2 + 101*i, 6)
end
sprite(player, CurrentTouch.x, CurrentTouch.y)
end