Week 4 – Developer Journal

Following up from the Phaser introduction, this week we’re introduced to Tiled which allows us to import and use ’tilesets’ to put together levels as ’tilemaps’. The first task being making a nice level to navigate with the supplied tileset, while doing this I experimented a lot with flipping tiles horizontally and vertically to create a lot of variation within the level and a particular favourite touch being pillars in the background.

Tilemap of 5 layers with its contents colour-coded
Foreground – assets that appear in front of the player
Platforms – tiles which the player primarily walks upon
ladders – tiles added with the intent to function as ‘ladders’
Props – assets which the player may collide with
midground – assets behind the player, intent to be decorative
background – the backmost layer which will function as a backdrop for the level.

When it came to coding, they were a bit of work to set up but they’re incredibly resourceful for setting up levels and pose as an alternative for adding static objects like collectables and hazards

code required for importing the tileset, tilemap and setting up layers.
Depths for each layer is also a lot easier to manage.

To add some objectives, I’ve brought in the stars from the previous Phaser project however this time, collecting all the stars will load the next level. To hint that this is the objective, the player is given a remaining stars counter.

Level Preview (Stars)

Developing on top of stars I also tried adding ‘upgrades’ the first of which is a white star that spawns randomly among the other stars but when you pick it up, it increases the maximum jumps – this was the only suitable thing I figured I could really upgrade.

Another benefit is collision events can also be made between specific tileset pieces, so in this case we could make another prop collectable for score much alike the stars.

Collecting the Mushroom tile and score increasing.
Collision check, adding score and removing tile function.

Another design choice I considered about the floor is a pit, I just wanted there to be a fall rather than tiles or spikes.
If the player fall down then they are moved back to the last tile they touched.
I initially tried to add this as a collider with the bottom worldbound but I couldn’t find the right code to work, so instead I built upon what I previous did by adding two new tiles to emulate a shadow that the player could collide with

Callback code
Callback in action

Leave a comment

Your email address will not be published. Required fields are marked *