ID:176071
 
Okay so, I'm looking for a way to make it so wherever your mouse pointer is, your mob will face it. such as your mouse pointer is in the NW region of the map your mobs dir becomes NW and from there if you decide to slide your mouse pointer to a more north position, your mobs icon will go from the NW dir to the N dir. Can anyone explain or show me a snippet on how to do this?

ETG
<code>turf/MouseEntered() usr.dir=get_dir(usr,src)</code>

Note that using MouseEntered() "generates extra communication that is otherwise avoided", according to the reference - in other words, that snippet of code will probably increase lag. =P
In response to Crispy
ok
thanks
In response to Erdrickthegreat2
OK, so heres my movement system so far...

client/Click()
mob.Fire(mob, mob.dir)

turf/MouseEntered()
usr.dir=get_dir(usr,src)

client/North()
step(src.mob, src.mob.dir)

client/South()
src.mob.dir = turn(src.mob.dir, 180)
src.North()
src.mob.dir = turn(src.mob.dir, 180)

client/East()
step(src.mob, turn(src.mob.dir, -90))
src.mob.dir = turn(src.mob.dir, 90)
client/West()
step(src.mob, turn(src.mob.dir, 90))
src.mob.dir = turn(src.mob.dir, -90)

client/Northeast()
return 0
client/Northwest()
return 0
client/Southwest()
return 0
client/Southeast()
return 0

I thought it would be easier to control for a shooting game, but it isnt. The lag isnt the problem its just that my mob faces my guy only on the 8 basic directions, so it isnt smooth at all, I was hoping there was a way so that the mob rotated on every degree. so it appeared smoother.

ETG
In response to Erdrickthegreat2
so, um bump, any help this time around?

OK, so heres my movement system so far...

client/Click()
mob.Fire(mob, mob.dir)

turf/MouseEntered()
usr.dir=get_dir(usr,src)

client/North()
step(src.mob, src.mob.dir)

client/South()
src.mob.dir = turn(src.mob.dir, 180)
src.North()
src.mob.dir = turn(src.mob.dir, 180)

client/East()
step(src.mob, turn(src.mob.dir, -90))
src.mob.dir = turn(src.mob.dir, 90)
client/West()
step(src.mob, turn(src.mob.dir, 90))
src.mob.dir = turn(src.mob.dir, -90)

client/Northeast()
return 0
client/Northwest()
return 0
client/Southwest()
return 0
client/Southeast()
return 0

I thought it would be easier to control for a shooting game, but it isnt. The lag isnt the problem its just that my mob faces my guy only on the 8 basic directions, so it isnt smooth at all, I was hoping there was a way so that the mob rotated on every degree. so it appeared smoother.

ETG