-
Notifications
You must be signed in to change notification settings - Fork 6
Nesting entities
Mark Knol edited this page Oct 18, 2017
·
3 revisions
This is a example to illustrate how to nest two Entities with sprites.
var myEntity = new Entity()
.add(new FillSprite(0x154d79, 100, 100)); // blue square
var myNestedEntity = new Entity()
.add(new FillSprite(0xefbf74, 40, 40)); // orange square
System.root.addChild(myEntity);
myEntity.addChild(myNestedEntity);
This can be written shorter:
System.root.addChild(new Entity()
.add(new FillSprite(0x154d79, 100, 100))
.addChild(new Entity()
.add(new FillSprite(0xefbf74, 40, 40)))
);
If you would rotate the Sprite of the container Entity then the content of the nested entity rotates along.
Documentation guide for Flambe - Targeted to version 4.0+
Flambe | Installation | Demo projects | Showcase | API Reference | Forum
Flambe is MIT licensed and available for free. Feel free to contribute!
- Home / Installation
- Entity / Components
- Core
- Assets
- Publish your game
- Other
- Editors
- Plugins, tools, extensions
- Help
- More Flambe