OK I have looked at the other posts involving inertia and they seemed a little complex for me so I came up with a simple solution to double the speed until we arrive at maximum speed and do the opposite until we arrive back at idle speed.
This is what I have so far
global sc_spd#=0.001
set display mode 800, 600, 32
sx=desktop width()
sy=desktop height()
set window position (sx-800)/2, (sy-600)/2
sync on : sync rate 60 : color backdrop 0 : hide mouse
` as you can see the background is simply a textured plain
load image "bg1.png",1
make object plain 1,800,600
texture object 1,1
position camera 0,0,-300
` My initial idea was to half or double the movement speed each sync but that doesn't seem to work
do
sc_spd#=0.001
if (rightkey()=1) or (leftkey()=1) or (upkey()=1) or (downkey()=1)
sc_spd# = sc_spd# * 2.0
if sc_spd# > 0.008 then sc_spd# = 0.008 ` 0.008 is max speed
ENDIF
if (rightkey()<>1) and (leftkey()<>1) and (upkey()<>1) and (downkey()<>1)
sc_spd# = sc_spd# / 2.0
if sc_spd# < 0.001 then sc_spd# = 0.001 ` 0.001 is min speed
ENDIF
if rightkey()=1 then scroll object texture 1,sc_spd#,0.0
if leftkey()=1 then scroll object texture 1,0-sc_spd#,0.0
if downkey()=1 then scroll object texture 1,0.0,sc_spd#
if upkey()=1 then scroll object texture 1,0.0,0-sc_spd#
ink rgb (255,255,0),0
text 10, 10, str$(sc_spd#)
sync
LOOP
The problem is that when I double the speed it will only do it once and then doesn't even bother to look if a key is pressed. How can I get it to double the speed each sync? I'm not worried aboutthe numbers for now because I will fiddle with the max and min values until they are right.
I have attached the background so you can try this if you are kind enough to help.
EDIT: I have just tried using keystate instead of scancode but still hit the same problem, the value only doubles once ???
Signature removed by moderator. Please do not give out the meaning of life in an open forum.