**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 For Each event as conditions and then actions will automatically run on all the objects (refined by the conditions). However, from time to time, For Each event can be useful to run an action that is depending on each instance of the object.

Examples

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: