Bad idea!
What if he wanted to go up and left simultaneously? With that code it is not possible. As SimSmall said ... use keystate.
Here is some code to demonstrate how to use keystate. Use W,A,S,D to move the sprite around.
Global x as float = 10.0
Global y as float = 10.0
Global Speed as float = 0.75
sync on
sync rate 60
MakeSprite()
`************** S T A R T O F M A I N L O O P ****************
do
GetUserInput()
UpdateWorld()
sync
loop
`**************** E N D O F M A I N L O O P ******************
function GetUserInput()
if keystate(30) then dec x , Speed
if keystate(32) then inc x , Speed
if keystate(17) then dec y , Speed
if keystate(31) then inc y , Speed
endfunction
function UpdateWorld()
sprite 1,x,y,1
endfunction
function MakeSprite()
create bitmap 1, 50,50
box 0,0,50,50,rgb(255,0,0),rgb(0,255,0),rgb(0,0,255),rgb(255,255,0)
get image 1,0,0,50,50
delete bitmap 1
endfunction
... and here is a list of scancode numbers to use with the keystate command: