The autocull component in phaser ce
The auto cull component in Phaser ce is a fairly simple component that just adds two boolean values. One of which can be used to enable auto culling of sprites in a project keeping sprites that are outside of the camera from rendering, and the other is just an inCamera boolean that can be used to find out if a sprite is outside of the camera or not. In this post I will be outlining a simple example that makes use of what is added to sprites in phaser ce thanks to the auto cull component.
1 - What to know
1.1 - This is a phaser ce 2.x post
In this post I was using phaser community edition 2.11.1 of phaser
2 - Example of the sprite.inCamera property
For an example of the inCamera property I made a demo that involves two sprites one represents a ship, and the other represents a pointer sprite that points to the location of the ship when it it outside the view of the camera.
2.1 - The update pointer method
So then here is a helpe that will be used to set the properties of the pointer, and ship sprites depending on the inCamera value of the ship sprite.
2.2 - Make a sprite sheet
This helper just makes a sprite sheet for the ship, and the pointer sprites using canvas.
2.3 - The Phaser.Game instance and state object
So now that I have my helpers I now just need to get everything working with a Phaser.Game instance and a state object.