How do I trigger an event only once for each object?

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • In my platformer, my enemies will not 'see' the player from far away. But when the player gets close enough they will see the player. And once they do, I want them to follow the player until they are killed.

    I was hoping to use the following code. I want to use 'trigger once' to keep this code from running every tick for each enemy once they have the increase LOS range. But 'trigger once' makes it so that this code only runs for the first enemy that sees the player. I know I can use an enemy instance variable like 'seesPlayer' and set it / check for it, but I'm all about keeping IVs to a minimum (I have so many already).

    Is there a way to write this code so that it runs only once for each enemy object?

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you really must turn off that condition then sure use a variable so the enemy can't be picked.

  • It dawned on me that I can just check to see if the range is already set to LayoutWidth, and if so ignore.

    I must be tired...

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