How do I pick all instances which do not fit the conditions?

  • I'm making a little system for highlighting interactive objects close to the player in this platformer/adventure-game thing. It uses a big invisible circle over the player that acts as the area in which interactive parts of the environment can be interacted with. So, if an object in the 'Interactive' family overlaps this big circle AND it's the nearest instance to the player's position, it is highlighted with a boolean instance variable thing going 'true' and with a little visual effect.

    SO how do I then un-highlight an object? The easy part is un-highlighting anything not overlapping the player's magic invisible interactive circle. But I also want to pick all instances in the 'Interactive' family which are overlapping the circle but ARE NOT the closest instance to the player.

    I need to pick all instances which do not fit the condition "pick closest to player". How do I do this???

  • One way of doing this is to have a flag in an instance variable. Every tick you set it to false (which resets all of them). Then the next event you have some conditions to pick some of them and set their instance variable to true. Then you have an up-to-date flag per-instance for if it met the event.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh hey look at that, it works beautifully. Thank you!!!!

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