Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move contents of an entity #332

Open
ramachandran-prazas opened this issue Mar 12, 2015 · 1 comment
Open

Move contents of an entity #332

ramachandran-prazas opened this issue Mar 12, 2015 · 1 comment

Comments

@ramachandran-prazas
Copy link

Hi,

Is there a way to move / modify all the contents of an entity instead of moving / modifying them individually.

Thanks.

@markknol
Copy link
Contributor

You can nest entities inside eachother and move the parent entity's sprite.

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);

// move container using sine motion. the child entity automatically follows
myEntity.get(Sprite).x.behavior = new Sine(0, 200, 2);

https://github.com/markknol/flambe-guide/wiki/Flambe-core#nesting-entities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants