No trying to hijack just showing another approach, I wrote this ages ago. If you want me to delete it I will.
; Thrust type example by Rob Farley (http://www.mentalillusion.co.uk) ; Use the cursor keys to move it block around the screen Graphics 640,480,16 ; set graphics mode SetBuffer BackBuffer() ; set back buffer to enable screen flipping Cls ; set up some varibles all of the ones below have a # ; this means they are floating point numbers ie they have a decimal place x#=320 ;x position y#=200 ;y position xspeed#=0 ; xspeed yspeed#=0 ; yspeed ; these are the keys for control Const sets them up as constant varibles ; this means they can't be changed but it makes everything a bit faster Const k_left=203, k_right=205, k_up=200 , k_down=208 ; start the main loop Repeat ; note the loop is indented for easy to read code Cls ;clear the screen Color 0,255,0 Line 0,470,639,470 ;draw a green line at the bottom of the screen If KeyDown(k_left) Then xspeed#=xspeed#-.1 ;this adds acceleration in the correct direction If KeyDown(k_right) Then xspeed#=xspeed#+.1 If KeyDown(k_up) Then yspeed#=yspeed#-.2 x#=x#+xspeed# ;this adds the acceleration to the current x,y position y#=y#+yspeed# xspeed#=xspeed#*.99 ;this makes the xspeed 99% of what is was ie adds friction and slows you down yspeed#=yspeed#+.05 ; here we are adding gravity acceleration to the y direction so you're always being pulled down If y#>460 Then y#=460:yspeed#=-yspeed#/2 ; this is hitting the bottom of the screen and bouncing you up at half the speed you hit it If y#<0 Then y#=0:yspeed#=0 ; stopping you at the top of the screen If x#>650 Then x#=-10 ; wrapping you from right to left If x#<-10 Then x#=650 ; wrapping you from left to right Color 255,255,0 Rect x#-10,y#-10,20,20 ; draw a yellow rectangle at your position Flip ; flip the back buffer to the front so you can see what's been drawn Until KeyHit(1) ; back to the beginning of the main loop until ESC is hit End ; End the program