How do I change animation depending on angle of motion

Get help using Construct 2

Post » Mon Jun 20, 2016 11:32 am

Sounds like a easy problem to fix however i am programming a top down game similar to the
old zelda games and i have monsters that use the PATH properties to move around and seek out the player when the line of sight is active
the problem is i use animations to show what direction the monsters use instead of a rotation.

how can i have my monsters change animation when they are within certain angles of movement when using path finding?

an example that does not work
Monster - is between 315 - 45 degrees = Set animation to - MoveRight
B
5
S
1
Posts: 88
Reputation: 653

Post » Mon Jun 20, 2016 12:21 pm

Yes that works.
Just add a System> Once While True to that condition.

Now, you start the animation from the beginning every tick, this is why you see only the first frame.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Jun 20, 2016 2:45 pm

Here the example with a capx file.

https://www.dropbox.com/s/kjtnwzea3zd40 ... .capx?dl=0
B
48
S
9
G
10
Posts: 200
Reputation: 8,258

Post » Mon Jun 20, 2016 4:51 pm

thanks for the capx but thats not what im looking for, the player isnt the issue it is monsters that move on their own they also use the path finder property to move by themselves not an 8 movement default button key press.

i've added the extra bit of commands as you said however still does not work, what i should have said earlier is that the object does not actually rotate so as a result the angle is at a constant 0 even though it is moving at all sorts of angles trying to path find towards the player
B
5
S
1
Posts: 88
Reputation: 653

Post » Mon Jun 20, 2016 4:54 pm

This is a heavily inspired way i use the movement for the monsters like i said i cant seem to get the animations to change depending on the direction of the chase!

https://www.scirra.com/tutorials/474/pa ... e-of-sight
B
5
S
1
Posts: 88
Reputation: 653

Post » Mon Jun 20, 2016 6:32 pm

Upload a capx.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jun 22, 2016 8:20 pm

B
5
S
1
Posts: 88
Reputation: 653

Post » Wed Jun 22, 2016 11:07 pm

https://www.dropbox.com/s/dwx5nslrekv97 ... .capx?dl=0

Your random paths are (i think) to fast calling for a new path.
On failed is not not needed.
Those Pathfinding_Helper's are a great idea !
There are only 4 animations for 360 possible directions.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jun 23, 2016 4:22 pm

B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Thu Jun 23, 2016 6:43 pm

Hey @R0J0hound thats a nice way to do this. Thank you (for myself).

For topic starter ... his angles are the path angles.
He is not allowing the paths to rotate the objects.
Luckely the path angles are still in the expressions. the sprite.angle is always zero.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: Fradno and 15 guests