How do I check a condition within an action after clicking?

From the Asset Store
11 loops of RPG, chiptune/8-bit music. Suitable for any pixel art game.
  • So, this might be simple enough for some but please forgive me as I'm a relatively new user.

    I'm creating a point-and-click game, and I got a condition that basically says:

    - If you click on Object A, if Player is within 150 pixels of Object A he will pick it up.

    - If you click on Object A, and the Player is NOT within 150 pixels of Object A, he will walk to where you clicked first.

    Now, in the second case where the player is not within range, I want the system to check that after you clicked and the player reaches a certain point (150 pixels of Object A), he will then stop (-> Stop MoveTo) and pick up the object. But how do I check if the Player is within Object A's range after he's moving already upon a click?

    Thank you in advance

  • You can do this:

    On Click Object A

    >If distance(Player.X, Player.Y, ObjectA.X, ObjectA.Y) <= 150 >>> Action: Pick Up

  • Thank you, but this is actually what I already have. If you use this the system just checks if you are within 150 pixels upon clicking and then stops checking unless you click again. What I want is the character to move closer to the object and then check if he's within 150 pixels range to pick it up.

    Now I could write another if statement (condition) that simply checks if he is close enough, but then he will also pick it up when he accidentally walks past it, while I want him to follow the action after a click specifically.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So you can put it outside like this:

  • Hi, sorry for the late reply. Thank you for your input, it pretty much works though I replaced the distance check with line-of-sight behavior.

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