I'm currently making an object that accellerates as you press the up key, using the code below...
Sync On: Sync Rate 0
AutoCam Off
make matrix 1,10000,10000,300,300
CLS : Sync
Load object "F:\Game Creation\Dark Basic Pro\Projects\Zero Grav\Objects\testcraft.x",1
scale object 1,900,900,900
xrotate object 1,270
Position Camera 500,150,-50
Spd# = 0.0: `Starting Speed
Acc# = 0.01: `Acceleration Rate
z#=5000
x#=5000
Do
if upkey()=1 then inc spd#,acc# : x#=newxvalue(x#,a#,spd#) : z#=newzvalue(z#,a#,spd#)
if downkey()=1 then dec spd#,acc#+0.02 : x#=newxvalue(x#,a#,spd#) : z#=newzvalue(z#,a#,spd#) `Decellerate / Brakes
if leftkey()=1 then a#=wrapvalue(a#-0.5)
if rightkey()=1 then a#=wrapvalue(a#+0.5)
if upkey()=0 and spd# > 0.0 then dec spd#,acc# : x#=newxvalue(x#,a#,spd#) : z#=newzvalue(z#,a#,spd#)
if spd# <0.0 then spd#=0.0
if spd# >15.0 then spd#=15.0
`update object position
position object 1,x#,50,z#
yrotate object 1,a#
`Camera Gumf
cx#=newxvalue(x#,wrapvalue(a#+180),70)
cz#=newzvalue(z#,wrapvalue(a#+180),70)
cy#=80
position camera cx#,cy#,cz#
point camera x#,50,z#
Sync
Text 0,0,"Speed: "+Str$(Spd#)+" "
text 0,20,"FPS: "+str$(screen fps())+" "
text 0,40,"X#: "+str$(x#)+" "
text 0,60,"Z#: "+str$(z#)+" "
Loop
when you release the up key the object slowly decellerates, and what i was after was when you press the downkery the object would decellerate faster, kind of like using the brakes on a car, however with the code i have in place at the moment it speeds up momentarilly before starting to slow down any ideas how i can prevent this from happening?