' Run and Jump Demo ' By Allan Crossman ' A demo of reasonable looking acceleration / deceleration / falling. ' I've made negative vertical speed rise ' and positive fall (for simplicity). waitlength = 0.02 width = 400 depth = 200 left = screen width / 2 - (width / 2) top = screen height / 2 - (depth / 2) right = screen width / 2 + (width / 2) bottom = screen height / 2 + (depth / 2) resize console left, top, right, bottom cls virtue = init screen(0, 0, width, depth) set screen to virtue hardedge = 10 posx = width / 2 posy = depth / 2 speedx = 0 speedy = 0 MainLoop: cls forecolor 65535, 0, 0 text 10, 20, "A / S to run, SPACE to jump, Q to end." if posy < depth - hardedge then speedy = speedy + 0.3 keymap scan if keymap key ("s") then ' Key S pressed? speedx = speedx + 0.2 end if if keymap key ("a") then ' Key A pressed? speedx = speedx - 0.2 end if if posy = depth - hardedge then if keymap key (" ") then ' Space pressed? speedy = speedy - 8 end if end if if keymap key ("q") then disable done : end posx = posx + speedx posy = posy + speedy if posy > depth - hardedge then ' If we've gone through the floor posy = depth - hardedge speedy = 0 end if if posx < hardedge then ' If we've gone through the wall posx = hardedge speedx = (speedx * -1) / 2 end if if posx > width - hardedge then ' If we've gone through the wall posx = width - hardedge speedx = (speedx * -1) / 2 end if forecolor 65535, 65535, 0 fcircle posx, posy, 8 copyrect 0, 0, width, depth, 0, 0, width, depth, 0, virtue, 0 wait waitlength goto MainLoop