Trigger between 2 X coordinates relative to Playe?

Get help using Construct 2

Post » Thu Feb 13, 2014 9:17 pm

I have zombies that wander a 2d platformer. What I am trying to do is cause the zombies to change their animation to a jump/reach animation when they are under the hero.

I have it set up so the zombies are always moving toward the player, but after they reach a certain point if the Y coordinates are in the right range I want them to start jumping/reaching. Does this make sense?

Basically, I don't know how to write out the coordinates so that they are within a range. Like, Player.X"Within two X coordinates relative to the player"



B
3
Posts: 4
Reputation: 183

Post » Thu Feb 13, 2014 9:21 pm

What about the distance expression?

Or creating an invisible sprite that is pinned to the player and extends down from him. Then if the zombie is overlapping the sprite, trigger the jump.
B
101
S
32
G
11
Posts: 1,552
Reputation: 21,667

Post » Thu Feb 13, 2014 9:23 pm

System -> Compare two Values

In the first box you type something like:

distance(player.X,player.Y,zombie.X,zombie.Y)

smaller or equal to

for example 10 Pixels
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Thu Feb 13, 2014 9:42 pm

Distance as well as "Between two values" works for triggering EVERY zombie to jump, but not the ones within the range. I included the "For Each" condition, but it didn't seem to do anything. Every time they enter the range, every zombie starts jumping.
B
3
Posts: 4
Reputation: 183

Post » Thu Feb 13, 2014 10:36 pm

Make sure the 'for each' condition is first - before the distance check.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650


Return to How do I....?

Who is online

Users browsing this forum: Matei511 and 67 guests