ID:149956
 
I was just wondering what the best way to make movement act as if you were in a car . .like the up arrow would accelerate you, the down arrow would slow you down and the left and right make you turn.

thanks
Here's a really simple way:

mob
var
maxspeed = 100
speed = 0

client.North()
if(mob.speed>=mob.maxspeed)
return..()
else
mob.speed+=1
return..()
client.South()
if(mob.speed<=0)
return..()
else
mob.speed-=1
In response to Nadrew
i hate to tell you but that does nothign but make it so u can't move south unless speed = 0 . . i can't figure out how to make them continually move but yet if they continue to press the up key they speed up . . when i use walk they just stay at the same speed.
In response to Sizzer
I forgot return..() below speed-=1.
In response to Nadrew
now it acts like normal . . the only thing different from normal is its increase=ing or deacreasing the speed var . . it doesn't effect anything . .that i can see . .my key point is how to make them increase the speed while constantly moving
In response to Sizzer
Then add this:

client
var/delay = mob.speed - mob.movedelay//make a var for this
North()
//add the first code here
walk(mob,delay)//do this for south too.
In response to Nadrew
ok #1) unless this isn't working right the walk proc doesn't change the speed it seems to use the delay givven when the proc started (1) . .as i mention before

#2) the client/var/delay = mob.speed - mob.move delay shoudl be the other way around . .u would end up with a negative number and it won't let you declare it like that. it says it needs a constant expression.

so this is what i have . .

mob
var
maxspeed = 100
speed = 0
movedelay = 10

client.North()
var/delay = mob.movedelay - mob.speed
if(mob.speed>=mob.maxspeed)
mob.speed = mob.maxspeed
else
mob.speed+=1
walk(mob,mob.dir,delay)
client.South()
if(mob.speed<=0)
return..()
else
mob.speed-=1
return..()


*note* Ii took out the ..() in the north proc on purpose

and it only increases the speed if i stop by pressing another arrow and then press the up again
this is what i see happening

sorry for all the trouble . .
In response to Sizzer
No trouble, I've been giving not so good advice I'll get back to you after I get some sleep, unless someone else does first.