Posts > Building Game with Phaser: My 2nd Platformer game

Building Game with Phaser: My 2nd Platformer game

I made a new platformer game. The game might be similar to the first game in the sense platformer but this time I made it with more context like attacking enemies, going up and down a ladder ( object ), some obstacle that kills the player, camera moving with the player and opening doors with keys.

The Plan

I try to make the game as simple as possible so it have a minimalistic feels to it I think. Anyway I found a free asset in itch.io. I had some issue with sprites during build but not because of the asset, because of my lack of skills on sprites and how to properly use them.

My level design sucks so bad but hey at least I have a level. Though I had some improvement during the level building.

Repetition

I choose to make a platformer game again so that I can reuse some of my old code and familiarize more in making games with Phaser. I added some new feature on the game rather than just sticking on all the feature of the first one.

What’s different with this game?

The game is more of a “adventure” type game unlike before that you just need to collect all items in a level, this time you only have to collect one key to open the door so you can move to the next level. Also obstacle not only move back and fort this time the enemy moves when a player got close to them then attack. Yes player can also attack the enemy. Anyway too much information just play the game.

What I learned building the game?

Camera integration to a player character

Setting up a camera into a player that follows them is pretty easy, just using the Phaser built in camera method and adding which object they should follow.

Adding simple AI to Enemies

AI is pretty big word, but its actually just an if else statement I’d use to make the enemy move and interact with the player.

Sprites

It’s really annoying to making sure your sprite goes or do what you wanted, but handling them especially if the you don’t under the sprite your using can be so frustrating. My experience is I just find out if you flip the sprite it doesn’t mean that it will behave as you wanted it to be so best to make sure to test the sprite that you’re going to use.

Attack Zone for Enemy and Player

Attack zone is the imaginary box that you make so that when a Player attack an attack zone box will quickly enabled and when a enemy hit box collapse or overlap with it the enemy died and same to the player hit box. The difference is that enemy attack zone is automated while the player is triggered.

Ladders

I actually spent time making the ladder object work and I still don’t really get it. Ladder is really complex as you need so many things to check, whether the player is inside or outside the ladder object, the player is on top the ladder, what the player can do when inside the ladder. Here is the best resources I’ve found **Climbing Ladders in Phaser 3 .**

Custom Fonts

Phaser have a default fonts but it doesn’t limit you to use your bitmap as fonts, it’s easy like adding your images or sprites into the game, the issue is you have to stick to pixel size you have when you created the fonts ( basically it doesn’t scale so going to stick on that pixel you have ) I have a post regarding setting up your custom fonts here.

Finish Product

The goal in the game is very simple, player looks for the key and open the level door. But this time enemies will attack the player if the player get too close to them, but player can attack back too, also hazards like spikes are added in the game to make the game “interesting”. The final score will show the UI for total kills, retries, and I also show how long they finish the game.

The game is available to play in my itch.io account.

The game still have a lot of room for improvement for sure. It still have some issues that I can’t figure out right now, so I’ll try to fix in the future if I can and learn about how to go about the issue. Right now the first build can be played from start to finish. Hopefully in the future if I learned new stuff I can update this game and work on some of the issue.