ID:178704
 
How would i make it so if a usr turns East, the only face East the don't go East, as with all other dirs except north and south.
[EDIT] if you don't know what i mean, i mean like in TANKS.
-NilFisk
NilFisk wrote:
How would i make it so if a usr turns East, the only face East the don't go East, as with all other dirs except north and south.
[EDIT] if you don't know what i mean, i mean like in TANKS.
-NilFisk

You'd do something like this:
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,back)

Hope that helps you.
In response to Lummox JR
Thanks Lummox but i have 1 problem with it,

South()
var/back=turn(mob.dir,180)
var/turf/T=get_step(mob,back)
if(T) mob.Move(T,back)

i dont keep going back like when i move foward, i go back, then when i pres south again i just flip the other way, how can i fix this?

-NilFisk
In response to NilFisk
NilFisk wrote:
Thanks Lummox but i have 1 problem with it,

South()
var/back=turn(mob.dir,180)
var/turf/T=get_step(mob,back)
if(T) mob.Move(T,back)

i dont keep going back like when i move foward, i go back, then when i pres south again i just flip the other way, how can i fix this?

Hrm. I would guess then that the default Move() proc sets mob.dir to the second argument, if it's given one. Try changing that last line to this:
if(T) mob.Move(T,mob.dir)

Hopefully that will clear it up.

Lummox JR