Discord
Login
Community
DARK THEME

can someone help me with this code

when I stop moving the sprite just disappears

init = function() end

update = function()
local speed = keyboard.SHIFT and 3 or 1 if keyboard.LEFT then x = x - speed end if keyboard.RIGHT then x = x + speed end end

draw = function() screen.drawMap("map", 0, 0, 451, 200) if keyboard.LEFT then screen.drawSprite("sprite3", x, -70, 30) end if keyboard.RIGHT then screen.drawSprite("sprite4", x, -70, 30) end end

can someone please help me because I don't know what to do.

ok so draw = function() screen.drawMap("map", 0, 0, 451, 200) if keyboard.LEFT then screen.drawSprite("sprite3", x, -70, 30) end if keyboard.RIGHT then screen.drawSprite("sprite4", x, -70, 30) end end only draws when you are pressing keys you need like an else so if the keys aren't being pressed it just draws the sprite in place and isn't moved

if you invite me to your project I can add the code for you

Ok did it

Post a reply

Progress

Status

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