for each of
Details
Kode wheel segment | Timing and Logic |
Style | Object variable |
Modifiers | None |
Primarily WHEN/DO | WHEN |
Pre-made brains that use it | unknown |
Timing and Logic> for each of
Description
This tile has multiple uses.
Firstly this tile is used to specify how many times to run a line of kode. By pairing it with a number on the WHEN side it will run the DO side, and any child lines, that number of times.
Secondly this tile is used to apply kode to multiple objects within an object set. It will run the DO side for every object in the specified object set (which can be a custom one or a standard one (such as [all visible objects]).
Example Code
WHEN [once]
…WHEN [for each of][5] DO [create][apple]
This will create 5 apples
or
WHEN [once]
…WHEN [for each of][objset: enemy wave 1] DO [it][equip][sword]
This will equip all the characters in the enemy wave 1 set with a sword.
Note: For some reason this line of kode would not work if placed in a character brain that was part of the enemy wave 1 object set
Modifiers
None