Animation facing
macmasher
Member Posts: 31
What I'm wanting to achieve is when the main actor is right of the zombie that the zombie faces the actor, and when its left of it, it faces the actor. I have both animation sequences for the zombie walking left and right but I don't know how to go about making the zombie know which side the actor is on.
Comments
On the Main actor:
Constrain Game.MainActorX to self.positionX
On the zombie:
When Self.PositionX is less than Game.MainActorX
Play right animation
When Self.PositionX is greater than Game.MainActorX
Play left animation
As a side note if the left and right animation are identical but flipped you can just use the built in self graphcis flip horizontally to flip a single animation to work both ways. This will save memory and can use the same rules as above but with a change attribute.
self.motion.linear.x < 0
play right animation
self.motion.linear.x > 0
play left animation
Saves you some code and it gives better performance when not using constraints.