Trigger between 2 X coordinates relative to Playe?

  • 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"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

  • 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.

  • Make sure the 'for each' condition is first - before the distance check.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)