Working with Groups

Groups in Phaser (ergo in MightyEditor as well) are an ambiguous number of objects, partly acting as one. You can group something like 5 coin objects together and then manipulate with them all at the same time e.g. – enable physics, move or destroy them all with one swift line of code.

To create groups in MightyEditor, refer to the ‘Objects’ panel, there simply either select “Add Group” and then drag the objects in the group or select the objects you want to group prior to selecting “Group Selected Objects” (SHIFT-click to select multiple objects). In the image below you can see the creation of the background group, consisting of two objects.

To ungroup certain objects, simply select and drag them out of the group.

Now, while having the group selected, you can refer to the ‘Settings’ panel and change the following properties of the group conainer:

  • x, y – the location of the group on the game map in pixels;
  • angle – the angular transformation of the whole group in degrees;
  • isFixedToCamera – set to 1 (true) to fix this Group to the Camera at its current world coordinates;
  • alpha – the alpha value of the group container (transparency).

These setting will affect the whole group, but the children can have different properties.

Leave a Reply

Your email address will not be published. Required fields are marked *