ID:178909
 
Is there a way to switch an icon state based on movement?
I want an icon to look as if it is rotating as it changes directions , North, South , East Etc?

I tried redefining the North() South() East() West() procs like this

North()
usr.icon_state = "north"
..()

That did nothing?

Am I on the right track or way off base?

There's a movement option in DreamMaker's icon editor. Click the little video camera.
Shwn wrote:
Is there a way to switch an icon state based on movement?
I want an icon to look as if it is rotating as it changes directions , North, South , East Etc?

I tried redefining the North() South() East() West() procs like this

North()
usr.icon_state = "north"
..()

That did nothing?

Am I on the right track or way off base?

Nadrew is right about directional icons, but just to complete the answer here, I think the problem may be in using "usr." If I remember correctly, North() is a client proc, not a mob proc. It may have worked as:

North()
mob.icon_state = "north"

But go with directional icons... just easier.
Shwn wrote:
Is there a way to switch an icon state based on movement?
I want an icon to look as if it is rotating as it changes directions , North, South , East Etc?

I tried redefining the North() South() East() West() procs like this

North()
usr.icon_state = "north"
..()

That did nothing?

Am I on the right track or way off base?

I suspect to make it rotate while changing directions (simple directional icons are easy enough to do) you'd have to create animations to play with flick(). Probably this would entail a clockwise animation and a counterclockwise animation, each with the correct number of directions, and using it a certain number of times while changing direction like this:
client
North()
if(mob.dir&EAST)
while(mob.dir!=NORTH)
// turn 45 degrees counter-clockwise
mob.dir=turn(mob.dir,-45)
// directional animation rotating counter-clockwise
// *to* the new direction
flick(mob,"ccw")
sleep(8) // 8 tick sleep
else
while(mob.dir!=NORTH)
// turn clockwise
mob.dir=turn(mob.dir,45)
flick(mob,"cw")
sleep(8)
..()

You could get fancy and lock a player's movement for the duration, so they can't keep pressing the key.

I think those values for turn() are right, though I always forget whether it goes clockwise or counter-clockwise. I'm assuming it's clockwise here.

Lummox JR
In response to Lummox JR
Actually after Nadrews post I played around a bit and found the answer. I created an icon and then copied it with the edit->copy command. I then created an animation and rotated the icon as needed in the animation North,South, East, West. I then right clicked on the movie icon and set the state to movment. This worked however it would rotate and then switch back to the original icon causing an ugly flip flop effect. I deleted the original icon and left only the movie and all it works well.

Thanks for your help