
function to be execute once the page loads GameHeight: 800, // game height, in pixelsĬols: 8 // columns in the field, in unitsĬolors: // tile colors this object contains all customizable game options Select a tile with at least another tile of the same color around it, and see what happens. No doubt.Īnyway, this is the game we are going to create: This also happens when you buy a pizza at a restaurant, you complain because it’s not tasty, and they pretend to change your bad pizza with a new one but they just serve you the same pizza again. So the idea is never to delete removed tiles, which will be temporarily stored in a repository (in this case an array) until a new tile is needed, and we just recover the previously stored tile. This means 11 sprites destroyed and 11 new sprites to create.Īlthough I am sure Phaser has a good memory management and garbage collection, this can be very resource-consuming in the long run. That is, if you make a four tiles combo, you have to destroy the 4 old sprites and create 4 new sprites.

Then, new sprites should be created to replace the ones you just destroyed.

In this case, each time you pick and remove tiles, their sprites should be destroyed. Object pooling is a technique which stores a collection of a particular object that an application will create and keep on hand for those situations where creating each instance is expensive. This is an important update to the SameGame series because I making the game endless, allowing you to create most of the games mentioned in the post 10 successful games you can easily create starting from the SameGame engine and I am using object pooling to handle tiles management.
