Purpose of this.? How do I make a sprite move based off of a touch input?
I don’t know what this. Means and I believe I am eventually going to need it for something. Can somebody explain please? Also I don’t know how I am going to make a sprite move based off of a touch input, can somebody help me with this? Here’s my code so far: init = function() position_y = 0 button_pressed = 0 position_x = 0 end if touch.touching then // the user touches the screen else // the user does not touch the screen end
update = function()
end
draw = function() screen.fillRect(0,0,300,200, "#000268") screen.drawSprite("playbutton",0,0,40,20) while touch.touching and (touch.x >= -20 and touch.x <= 20 and touch.y >= -10 and touch.y <= 10) button_pressed = 1 break end if button_pressed == 1 then screen.clear("#002868") screen.drawMap("map2", 0, 0, 300, 200) screen.drawSprite("sprite2", -104, -46.5) screen.drawSprite("right", 120, -75, 40,40) screen.drawSprite("left", 96, -75, 40, 40) screen.drawSprite("up", -108, -63, 40, 40) screen.drawSprite("down", -108, -87, 40, 40)
end while true if touch.touching and (touch.x >= 110 and touch.x <= 130 and touch.y >= -85 and touch.y <= -65)then sprite2y = -46.5 sprite2x = -104 screen.drawSprite("sprite2",, sprite2y) else return false end end
end