ID:176978
 
anyone know a snippet to make a car(or just the main player mob) move forward when pressing up and steer left and right when pressing the according keys, you know like a gta 2 car,
or if not, like the car code in GTA on byond. but the first one is prefered
In response to SkylineR34
Do you want pixel movement or tile based movement? Unless you know some trigonometry I suggest you stick with tile-based movement. For tile-based movement you could make client.North() move you in the direction you are facing, and East() and West() would turn you 45 degrees left or right. You could use: client.North() (East and West too), the step() proc, and the turn() proc
In response to OneFishDown
i dont exactly understand that, not pixel based, but tile based, could you give me an example
In response to SkylineR34
You will have to fill in the blanks, but it tells you what pre-defined procs to call. You would just have to look them up in the DM help.
<code> client North() //step forward //usr the step() proc East() //turn right 45 degrees //use the turn() proc West() //turn left -45 degrees //use the turn() proc South() //optional, step backwards (reverse) //i would use the step() proc and the turn proc inside //of it to step the player their dirction turned 180 degrees </code>
In response to OneFishDown
client

North()


East()


West()


mob
proc
North()
step(src,forward) <-- i dont know!!


mob
proc
East()


mob
proc
West()

i really dont understand how to do this, ive never worked with anything like this before
In response to SkylineR34
Look up the step() proc. Look up the turn() proc.
In response to Garthor
client
West()mob.dir=turn(mob.dir,45)
East()mob.dir=turn(mob.dir,-45)
North()
var/turf/T=get_step(mob,mob.dir)
if(T) mob.Move(T,mob.dir)
South()
var/back=turn(mob.dir,180)
var/turf/T=get_step(mob,back)
if(T) mob.Move(T,mob.dir)


RaeKwon