How to "search" an object

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello, I am trying to code something that will, when the player stands on a certain object and press a key (shift for example), it would do something (for example, displaying a text).

    I could use "Is overlapping" but since I have multiple objects I wondered if there is a way to make things faster. Thank you in advance for your answers :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, I am trying to code something that will, when the player stands on a certain object and press a key (shift for example), it would do something (for example, displaying a text).

    I could use "Is overlapping" but since I have multiple objects I wondered if there is a way to make things faster. Thank you in advance for your answers

    You mean is gonna overlap multiple instances of the object at the same Time?

    if not, Player is overlapping object is fine as you gonna use it in a subevent under a trigger

    "On Shift Pressed"

    Subevent: Player is overlapping object

    but an alternative if you don't wanna use overlaps you can use "Pick the Nearest"

    On Shift Pressed

    subevent >>object "Pick the Nearest" to the (Player.X, Player.Y)

    >>Distance is Less than (your Value) >>>do your Actions

    An alternative

    On Shift Pressed

    subevent >>you can use "Line Of Sight" to the object

  • Thank you very much for the quick answer

  • "Is overlapping" is probably actually already the fastest way. It uses collision cells to avoid even checking far-away objects. Other conditions like pick nearest/furthest check all instances, even if they are far away, so are potentially slower.

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