ID:154286
 
Ok I'm working on a car game at the moment, and I want to change the use of the up and down arrows. Right now I just have it going forward and reverse like Tanks. But I want to make it to where if you press up, it increases your speed of constant motion. I already tried this with walk() but that will not work with my turning code, it must work with step(). Anyone have any suggestions?

LJR
Actually, i think it WOULD work with walk.. You just have to use it right.. Something like this:
mob
var
speed = 10
client
North()
walk(usr,NORTH,usr.speed - 1)
usr.speed -= 1

Everytime you press up, you will go faster..
This is just an idea, not sure if it would work.


Wħĭťë FļãΜê

Try this:

mob
New()
..()
anchor
if(src.speed == 0)
spawn(5) goto anchor
step(src.dir)
var/wait = client.Speed
if(client.Speed > 10) wait = 10
spawn(11-wait) goto anchor
client
var/Speed = 0
NORTH()
if(src.Speed < 15)
src.Speed += 1
SOUTH()
if(src.Speed > 0)
src.Speed -= 1
In response to Lord of Water
Cool code snippets guys! I can find use for them in my StarTrek game - I needed something small to accelerate/decelerate the ship...
In response to White Flame
hey white flame your anme spazed out at the bottom lol