Here's a simple demo:
VAR X,Y'Position XY VAR VX,VY'Velocity for each XY. Unlike acceleration, this is the actual movement speed of the player. VAR AX,AY'Acceleration for each XY. This will be reset every frame. VAR MVSP=0.3'Movement speed. Zero point three pixels per frame of button press. VAR FRCTN=0.9'Think of this as "how much velocity do I want to preserve after the character strikes a wall?" VAR BN'Button variable WHILE 1 BN=BUTTON() PHYSICS COLLISION RENDER VSYNC WEND DEF PHYSICS INC AY,0.5'Simulates gravity IF BN AND 1 THEN INC AY,-MVSP IF BN AND 2 THEN INC AY,MVSP IF BN AND 4 THEN INC AX,-MVSP IF BN AND 8 THEN INC AX,MVSP INC VX,AX INC VY,AY AX=0 AY=0 END DEF COLLISION IF(X<0)OR(X>400)THEN X=MIN(MAX(X,0),400):VX=-VX*FRCTN IF(Y<0)OR(Y>240)THEN Y=MIN(MAX(Y,0),240):VY=-VY*FRCTN END DEF RENDER GCLS GPSET X,Y ENDDon't shoot me if it doesn't work or doesn't look good. I can't quite test it atm, but this is the generic setup I use when dealing with a game's physics: Physics, collision, then render.