Version 1 (modified by Josh, 10 years ago) ( diff )

Add page on the GUI repeat object

Repeat

The repeat object is designed to simplify cases where you have a large number of very similar objects nearby each other.

Explanation

The repeat object generates "count" copies of any objects nested within it. Since you can not have multiple copies of the same named object you insert "[n]" somewhere in the name. After parsing, the "n" is replaced with the index of the generated object in the repeat.

Important: The repeat element does not automatically adjust child element sizing.

Example

For example, the following XML could be simplified by using a repeat element.

<object name="myObj[0]" type="sprite" sprite="mySprite"/>
<object name="myObj[1]" type="sprite" sprite="mySprite"/>
<object name="myObj[2]" type="sprite" sprite="mySprite"/>

The next snippet uses the repeat element to create the same result.

<repeat count="3">
    <object name="myObj[n]" type="sprite" sprite="mySprite"/>
</repeat>
Note: See TracWiki for help on using the wiki.