Game Development Reference
In-Depth Information
After running this, “Two” is now displayed below the “Cha-Cha Cha” text, and the place where “Two”
was displayed is now blank, or empty.
Let's add the text “One” to the group:
grp:insert(text1)
When we refresh, everything should look the same as before. Let's try to position the group that
contains the text “One.”
grp.x = 100
grp.y = 20
On refreshing the simulator, the text “One” moves, as shown in Figure 8-7 . It is now in the position
where the text “Two” used to be, but a bit more to the right. Although we modified the position of the
group, the text moved because it is contained in the group.
Figure 8-7. Displaying text in a group
By default, everything has a parent, or a group in which it is contained. The root, or parent, group of all
elements created is referred to as the stage . We can access that via the display.getCurrentStage()
function.
Search WWH ::




Custom Search