please help
i want to make it so that i can press R and change the player sprite so far: init = function()
subrace = "subrace" player = object position_x = 0 position_y = 0 setPosition = function(x,y) position_x = x // sets player.posidation_x position_y = y // sets player.position_y end end end
update = function() if keyboard.R then subrace = subrace + 1 end
if keyboard.W then position_y = position_y+1 else if keyboard.S then position_y = position_y-1 else if keyboard.D then position_x = position_x+1 else if keyboard.A then position_x = position_x-1 end
end end end end
draw = function() screen.drawSprite( "subrace_button", -150, -80, 64, 36 ) screen.clear
if keyboard.W or keyboard.S or keyboard.D or keyboard.A then screen.drawSprite( subrace, position_x, position_y, 16, 16 ) screen.clear() screen.drawMap( "level1", 0, 0, screen.width, screen.height ) else screen.drawSprite( subrace, position_x, position_y, 16, 16) end screen.drawSprite( subrace, position_x, position_y, 16, 16 ) screen.drawSprite( "subrace_button", -150, -80, 64, 36 ) end
i press R and it goes through all the sprites