Ok so here's the example:
rem 9 for top, 88 for bottom
player0:
%10011001
%01000010
%00100100
%10011001
%10011001
%00100100
%01000010
%10011001
end
player0x = 50 : player0y = 50
__game
COLUP0=$82
if joy0up then player0y = player0y-5
if joy0down then player0y = player0y+5
if player0y < 10 then player0y = 10
if player0y > 85 then player0y = 85
drawscreen
goto __game rem code is over We have a big problem though, the player goes way to fast and doesn't look gird based at all... So we need a variable Right before any other code type this... dim _movement = a This will be our movement variable taking up variable "a" Now let's put it to use... We want to be able to move at the beginning so add this before __game -> _movement = 1
Also add this after COLUP0 --> if _movement = 0 then goto __game
Now add a colon after the player movement commands like this... if joy0up then player0y = player0y-5 : _movement = 0
if joy0down then player0y = player0y+5 : _movement = 0
Now when you push on the joystick _movement will become 0, this will skip the movement commands and make the player not be able to move. Of course we want the player to move multiple times, so we need to add one final code strip... Add this after COLUP0 if !joy0up && !joy0down then _movement = 1 Now everytime the joystick goes up or down, you only move 5 once... However the sprite seems to disappear whenever you hold up or down, I would fix that now but I have to eat dinner, so I'll be back Here's the full example... rem 9 for top, 88 for bottom
dim _movement = a
player0:
%10011001
%01000010
%00100100
%10011001
%10011001
%00100100
%01000010
%10011001
end
player0x = 50 : player0y = 50
_movement = 1
__game
COLUP0=$82
if !joy0up && !joy0down then _movement = 1
if _movement = 0 then goto __game
if joy0up then player0y = player0y-5 : _movement = 0
if joy0down then player0y = player0y+5 : _movement = 0
if player0y < 10 then player0y = 10
if player0y > 85 then player0y = 85
drawscreen
goto __game