Actor not knowing he is moving some directions.
So I have and actor that chases the main actor. This works with no probs. Now I have tried to have the actor who is chasing to know which direction he is going by having a number appear at different angles when he changes directions. For some reason only 4 of the directions display the number correctly. When going Sw,S,Se,E the number appears. When going Ne,N,Nw,W the number does not appear even though the actor moves in that direction. I have also tried animating him based on the direction and have had the same results.
I use vectorToAngle with joystick controls.
This is the actor logic
contrain - self.direction to vectorToAngle( self.Position.X - game.GoodGuysX , self.Position.Y - game.GoodGuysY )
his movement
Move to - game.GoodGuysX game.GoodGuysY speed 100 relative to scene
then I have his number appear bases on angles
N - >= 225 < 270
Ne - >= 180 < 225
E- >= 135 <180
Se- >= 90 < 135
S- >= 45 < 90
Sw- >= 0 < 45
W- >= 315 <= 360
Nw- >= 270 < 315
I have also tried using self.drection as an real,integer and angle..
I have been trying to figure it out.. Only Sw,S,Se,E work properly..
Thanks,
I use vectorToAngle with joystick controls.
This is the actor logic
contrain - self.direction to vectorToAngle( self.Position.X - game.GoodGuysX , self.Position.Y - game.GoodGuysY )
his movement
Move to - game.GoodGuysX game.GoodGuysY speed 100 relative to scene
then I have his number appear bases on angles
N - >= 225 < 270
Ne - >= 180 < 225
E- >= 135 <180
Se- >= 90 < 135
S- >= 45 < 90
Sw- >= 0 < 45
W- >= 315 <= 360
Nw- >= 270 < 315
I have also tried using self.drection as an real,integer and angle..
I have been trying to figure it out.. Only Sw,S,Se,E work properly..
Thanks,
Comments
Also, you want it to be a real attribute.
Ace
Then instead of using "move to" behavior which is broken, use the "move" behavior and in the direction of movement use your self.direction Angle attribute.
The next is important to understand how angles work in gs:
in your actor put a display text behavior to display your self.direction and see the values according to the direction of movement !
Write down (accually write on paper) the values for going left,right etc , then base your rules on those values.
Hope it will help you a bit
Roy.