// register our bullet object into the object pool pool.register("bullet", BulletEntity, true); // ... // when we need to manually create a new bullet: letbullet = pool.pull("bullet", x, y, direction, velocity); // ... // when we want to destroy existing object, the remove // function will ensure the object can then be reallocated later game.world.removeChild(bullet);
a default global ObjectPool instance pool
See
ObjectPool
Example