How do I Teleport an NPC when it is distancing itself?

0 favourites
  • 5 posts
From the Asset Store
Fantasy RPG Human-NPC assets pack of 15 characters
  • A little question, I'm creating a game where a drone should follow the main character, but the big problem is that it (the drone) hangs on some platforms

    I do not want to have to turn off the drone collision, is there a way to in certain X or Y the Drone teleport to near the player again?

    My English is very bad, sorry if anyone has difficulty understanding the topic.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can measure the distance between the player and the drone using the distance system expression, and lets say if its bigger then 200 px then you teleport the drone to player xy location.

    distance(x1, y1, x2, y2)

  • You can measure the distance between the player and the drone using the distance system expression, and lets say if its bigger then 200 px then you teleport the drone to player xy location.

    distance(x1, y1, x2, y2)

    Thank you man, it worked.

  • Update

    The term "Distance" works fine, but it requires a relatively large difficulty for those who have little experience in Construct 2, so I researched and found a much simpler method, consisting of the use of Behaviors "Line of Sight"

    I applied this Behaviors in the Drone in question (it can be in the player too, it makes no difference in this case)

    And I have changed the following options

    -Obstacles: Custom (formerly Solids)

    -Range: 150 (goes out of your necessity)

    Do not forget to look if the cone of view option is 360 °

    And I created the following event

    Drone>Has Line of Sight to> Player> Drone Set position> Player

    In the "Has Line of Sight to> Player" part, right click and select the Invert option

    Drone>Has Line of Sight to> Player> Drone Set position> Player

  • Great, there is always more then one method to do it

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