Today I have added the ladder and with it the vertical room transition. This is different, because each floor has its own background image that is pinned to the camera, but will change when switching floors. I’ve also added the sounds for walking, jumping, landing and moving boxes. All those actions got dust clouds, too.
The ladder is a only a trigger (BoxCollider2D
with isTrigger = true
) and when the player presses up/down, I check whether a climbable (the layer of the ladder) in that direction is available.
I then switch the player into the climb mode, during which I disable the player physics completely as I do not want him to collide with the floors or start to fall. The position automatically transitions towards the horizontal center of the climbable (ladder in this case) and the up/down keys accelerate the player in that direction.
When reaching the ground or the upper end of the ladder, the mode is left and the normal movement starts again. The player can also jump to leave the ladder.
The new dust particles are standard unity particle systems with a material that uses a flipboard texture to animate the dust clouds.
The addition of sounds is pretty straight forward. I’m using my own class called SoundPalette to have some variety. It supports adding a number of sound clips with a propability each and a min and max pitch for some additional variety.