Episode 3: Getting Started with Phaser

As I mentioned before, I had no idea how to use a framework or build a proper game heading into this. In the past I’d just aimlessly start coding a random feature until it was sort of working, then I’d move on to another random feature. I had no strategy, no direction, and no plan.

This time was different – I had a framework, I had examples, and I had documentation. So I started by trying to get Phaser to do some useful stuff.

The Basics

First I learned how to add Phaser to my code…

Then I learned how to load a sprite…

And draw it to the screen…

Then I learned how to add controls…

And move the player…

I learned how to prevent the player from leaving the screen…

Or kill the them when they leave the screen…

At this point I was feeling really good about the whole framework thing. Rather than trying to figure out how to write code that would draw and move stuff, I was just drawing and moving stuff. It was empowering.

After spending a few days playing around with sprites, I tried adding music and sound effects…

And text too.

For everything I could think of adding to my game, Phaser could do it. All I had to do was Google “Phaser add sprite” or “Phaser play music” and the answer would come up! My framework was allowing me to turn my ideas into code at an incredible rate.

This is probably super obvious to any experienced game developer, but for me it was eye-opening. Game-makers make game-making faster and easier! Who knew?

I’ll be including more code examples in future posts, but I won’t be going into too much detail. In other words, I’m going to focus on what I did, not how I did it. If you want to learn more about using Phaser, check out the examples and tutorials on their site.

Leave a Reply