User Tools

Site Tools


Nested Objects

GP allows you to build up a composite object

Visual programming creates new approaches to solve new problems. Sprite nesting is a great example for this. It creates a hierarchy between two objects by making one the owner and the other one a part.

Lets say you have two objects, a wheel and a car body. You can combine them into a single composite object by dragging the wheel onto the car and then shift-right-clicking on the wheel and selecting “attach…” from the menu.

This will present a menu of objects to which you can attach the wheel. Select car here to nest the wheel into it. Now the combined object made out of the car and the wheel acts like a single object.

If the car is moved about - the wheel will move with it

But because the wheel is actually its own object, you could make it spin around its own axis while the car is moving to give a much better visual effect.

Checkout the Ferris Wheel example in the GP examples folder to see this facility in action.

Developer Mode Only: After two objects have been nested this way, they can reference each other using the reporter blocks “owner” (reports owner of block), and “parts” (reports list of parts); they can be found in the “Structure” category.

starting/nested.txt · Last modified: 2017/10/05 06:17 by simplesi