I'm missing something about distance expression

  • Hello everyone.

    I think I overdid myself today and now can't even see the most basic things I need to see. I checked the forums and tutorials and some capx's, but still no find.

    Here is the thing: I want my turrets to play a "shutdown" animation when player moves a set distance away from them, ie the turret loses it's target. I'm reading everywhere a system.distance expression but I can't find a way to implement the desired effect.

    The reverse is easy, when target acquired I play the "powering up" animation. But there is no set "on target lost" condition for turrets.

    Help ? :)

  • If you're using the distance expression:

    distance(Turret.X, Turret.Y, Target.X, Target.Y) > YourRange

    If your distance is greater than the variable YourRange, perform actions.

  • Hey Nimitrix, I cant place a distance condition anywhere on conditions? How do I create a condition including a distance expression?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Nimitrix, I cant place a distance condition anywhere on conditions? How do I create a condition including a distance expression?

    Use any comparison condition, like one you'll find for instance variables. Place the distance formula in the empty box. If necessary, system menu offers 'compare two values' where you can compare any two values you choose.

  • > Hey Nimitrix, I cant place a distance condition anywhere on conditions? How do I create a condition including a distance expression?

    >

    Use any comparison condition, like one you'll find for instance variables. Place the distance formula in the empty box. If necessary, system menu offers 'compare two values' where you can compare any two values you choose.

    Thanks Nimitrix, yesterday late into night I solved it out thanks to you :)

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