**This is an old revision of the document!**

For Each events

A For Each event is a kind of event that will take an object as parameter. Then, during the game, for every instance of the object, the conditions and actions will be repeated.

Usually, you don't need to use “For Each” events as conditions. Actions will automatically run on all the objects (refined by their conditions). However, from time to time, “For Each” events can be useful to run an action that depends on each instance of the object.


When to use it

Consider this example. When the player is in collision with an object called “KillAllEnemyBonus”, we set the “life” variable of all enemies to 0. We also want to create a special kind of explosion at the position of each enemy. We need a For Each event, otherwise a single explosion would be created a the position of the first enemy: