Do you have a tip you’d like added ? Post in the comments below or send me an email.
What is Phaser?
Phaser is a fast, free and fun open source HTML5 game framework. It uses a custom build of Pixi.js for WebGL and Canvas rendering across desktop and mobile web browsers. Games can be compiled to iOS, Android and desktop apps via 3rd party tools like Cocoon, Cordova and Electron.
Along with the fantastic open source community Phaser is actively developed and maintained by Photon Storm Limited. As a result of rapid support and a developer friendly API Phaser is currently one of the most starred game frameworks on GitHub.
Thousands of developers worldwide use it. From indies and multi-national digital agencies to schools and Universities. Each creating their own incredible games. Grab the source and join in the fun!
On to the Tips…
- When using tweens, set the value to a string instead of a number to make the tween relative to the current value.
- When working with pixel art set roundPixels to true to prevent Phaser from rendering graphics at sub pixel locations (which causes blurring)
- When you need to set a property on all children in a Group, don’t use a loop, simply use setAll.
- Need the benefits of using a sprite as a container and a group just wont cut it? Use a blank sprite!
- Destroying an object in the onComplete callback of a tween being performed on the object will cause errors. You can either kill the object (does not destroy the object or remove it from memory), or delay the destroy call by one frame.
- Have a full screen background? Set Phaser.Game.clearBeforeRender to false to get rid of the un-needed clear screen draw call.
- Making a production build of your game? Disable Phaser.Debug to get rid of the un-needed empty texture draw call (Even if you are not using Phaser.Debug at all (which you should never do in production anyway) an empty texture is drawn.)