-
Notifications
You must be signed in to change notification settings - Fork 6
Creating entities and adding components
Mark Knol edited this page Oct 18, 2017
·
3 revisions
This is a example to illustrate how to add a entity to the root, with a visual component that displays a blue square of 100x100px, using a FillSprite
// Create Sprite Component
var mySprite:FillSprite = new FillSprite(0x154d79, 100, 100);
// Set position
mySprite.setXY(30,30);
// Create Entity
var myEntity:Entity = new Entity();
// Add the component
myEntity.add(mySprite);
// Add Entity to the root of the System, so it will show up on your screen.
System.root.addChild(myEntity);
This can be written much shorter thanks to the chaining syntax.
// Create entity and add a FillSprite component to the root of the System.
System.root.addChild(new Entity()
.add(new FillSprite(0x154d79, 100, 100)
.setXY(30,30)));
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