The deal with Pausing a game in phaser

So when making a game with Phaser ce one of the many subjects that come up is how to handle pausing the game. There are many ways to do this such as having an array of update methods, and have it so that there is a string value that will result in a different update method that will not update or change the game state in any way. However there is also of course a phaser ce built in way to pause the game as well, it is just a simple boolean value in the game object instance. There is also the pause method of a state object that can be used to define some logic that will be called once this boolean is set true by whatever means. In any case this post will be an overview of what to know about when it comes to making a pause feature in a phaser ce project.

Read More

Enabling frame by frame stepping in phaser

When making a game using Phaser ce as a framework, there might comes a time that for one reason of another I will want to have the game run in a frame by frame basis. For the sake of some kind of turn based game, or I need to hunt down a hard to find bug, there comes a time that I need to do this now and then. In phaser ce there is the game.enableStep method along with game.step, that can be used to enable frame by frame stepping. In this post I will be writing about a quick demo I put together to help show how easy this is.

Read More

Setting default values with lodash

So when it comes to making helper methods, or constructor objects that are a little complex with javaScript there will be a need to pass many properties to these kinds of functions. Some of the properties might be mandatory, other might be optional, but in any case there might be a need to set some default values for these options or class properties of an object in question.

There are native ways of parsing options for methods, or objects in general, however in lodash there is a quick convenience method that can be used to handle this process which is called the _.defaults object method. In this post I will be showing some quick use case examples of the _.defaults method, as well as some vanilla js alternatives when it comes to option parsing and javaScipt methods.

Read More

Fixing Sprites and other display objects to a camera in phaser

Sow when making a game with Phaser ce that is the kind of game where the world is bigger than the native size of the canvas, there will be a need to pan around the world some way. When doing so there might be some display objects that I will want to have fixed to the camera. One way would be to just update the positions of these sprites, text object, and groups manualy in the update loop. However there is a way to have a group fixed to the camera, so when the camera moves all these other objects move with it relative to it’s position. In this post I will be writing about doing just that with groups, and some corresponding properties.

Read More