So i have been trying to make an object realistically accelerate and decelerate. I have the following code, and in it, it works fine but there's one very small bug. When i start out in the center of the screen, if i just ever so slightly tap the key, the cube moves to the right very slowly. i was thinking that could get annoying in a game, so any way to fix that?? Thanks for your support
sync on
sync rate 60
backdrop on
color backdrop rgb(0,0,0)
make object cube 1,100
x#=0
speed#=0
do
if leftkey()=1
if speed#<1
inc speed#,.1
endif
inc x#,speed#
endif
if leftkey()=0
if speed#>0
inc speed#,-.05
endif
inc x#,speed#
endif
position object 1,x#,0,0
sync
loop
Behold the new marble game coming soon: [href"http://forum.thegamecreators.com/?m=forum_view&t=178472&b=8&p=0"]Marbsticle Course [/href]