Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Jon123

Is there a way of looping through every entity and calling a certain method that they all contain?

I am creating a game that requires all entities to stop moving on a certain trigger, but don't want to have to find them all by type...

Any ideas?

1 decade ago by jerev

game.entities contains all your entities.

for( var i = 0; i < ig.game.entities.length; i++ ) {
	ig.game.entities[i].doSomething( );
}

1 decade ago by Jon123

Oh good that's easy! Thanks
Page 1 of 1
« first « previous next › last »