We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello all,
I am referring to
// Make the parent shape
PShape alien = createShape(GROUP);
// Make two shapes
PShape head = createShape(ELLIPSE, 0, 0, 50, 50);
PShape body = createShape(RECT, 0, 50, 50, 100);
// Add the two "child" shapes to the parent group
alien.addChild(head);
alien.addChild(body);
// Draw the group
translate(width/2, height/2);
shape(alien);
and to
For a full example that demonstrates a PShape that groups together a primitive shape, custom polygon, and path, see "GroupPShape" (under File > Examples > Topics > Create Shapes). PShape groups allow you build a sophisticated hierarchy of shapes. This in turn allows you to set the color and attributes of the child shapes by calling the corresponding method at the parent level. Similarly, by calling the transformation functions at a given level of the hierarchy, you only affect the shapes below.
But how can I remove a child from the group?
Where is a full list of the commands?
Thanks!
Chrisir ;-)
Answers
If you use the PDE X mode, you can see all the commands for a given object or whatever.
Set your mode to PDE X and in your above code type alien and you will see a list of commands available to that PShape, including removeChild(int).
See: http://www.processing.org/reference/javadoc/core/processing/core/PShape.html
You can use the index to remove a child from a group. For example:
thanks!