For my final prototype, this game is going to be within the platformer genre. In which I will be following the story basis of a Prince escaping in light of an invasion taking place on the castle, once again sticking to my theme of Medieval Fantasy to keep things consistent and my interest strong.
Early Stages
Just like the beginning of any project, the setup phase comes first. In this case I needed to do something differently and that was in the introduction of the tile palette that’s to be used to paint my ground and such within the level for the player to be able to walk on without having to individually place sprites constantly. Considering I had no fully fledged artwork done for sprites I merely used bland assets that I threw together within Photoshop to make do for the time being. Although once my grid was set I needed to ensure that each time I painted a block onto the screen that it’s physics were correct, therefore I made sure to add a RigidBody 2D that I set to Static to prevent it from moving at all and both a Composite Collider and a Tilemap Collider which worked together in unison to ensure that the blocks didn’t have individual collision borders and instead joined them together when they were connected. Examples representing the implementation of both the tile palette and the components are shown below:
Due to the fact I do not have ready-made animations prepared for my player I was unable to incorporate those elements that were outlined within the guidance. I did however pay close attention to the implementation of elements such as the Animator, the Dopesheet and the flow chart that you are able to manipulate within Unity to tell it when to display specific animations when either idle of moving. I did however write a small script that was responsible for the player’s movement back and forth. An example of my placeholder player sprite and labelled script is shown below:
Now the player can move from left to right, I wrote up yet another script that lets the player jump. Not only this however as another addition is that the player can also double jump in succession. This is easier as it sounds as in order to achieve this effectively I needed to create a gameobject within the player sprite that served as a groundchecker in order to stop the player from being able to jump infinitely, limiting the amount of jumps they have once they leave the ground. Meaning I had to create a Layer dedicated to the ground so that the groundcheck GameObject was able to recognise it and execute the code correctly. Labelled examples of the code are shown below:
Building Up
My next step was rather simple as opposed to the others, for this step I created a script that tells the camera to follow the player instead of being static, this means I can create bigger levels which are outside of the camera and let the player have an unseen perspective of what is yet to come. A labelled example of the script is shown below:
With the player movement and camera lock fully in place, it was time to implement hazards that will block the player from progressing such as enemies and spikes in this case. Firstly starting with enemies, just like ValorousVigil (my previous project) once the enemy makes contact with the player directly the player dies, ending the game. However this time the player can destroy the enemies with direct contact too rather than projectiles, the way this is done is using the previously mentioned groundCheck gameobject to collide with the top of the enemy when jumping on them, destroying the enemy in a generic platformer style way. So from hindsight the player has two colliders, one for destroying the enemy and one that destroys them. In addition, instead of the enemy just dying abruptly there’s a process within this script that gives it a sort of animation, knocking it from the map with a bounce. I used a separate script from this for the destruction of the player, this is due to the fact that I can also apply this same script to my spikes as they both destroy the player upon direct contact. Labelled examples of both scripts are shown below:
Final Result
Due to the fact I had no assets prepared for this project the end result looks rather bland, however it still functions despite their being no end goal either. It’s certainly something that needs work and a Platformer type game is most definitely something I will be working on in this future. What I learned this time around is primarily how effective ground checking can be and how non-linear it is as it can be applied to many different aspects of mechanics. Another good lesson from this was the tile palette, which makes level building far easier than independent placement and saves a bunch of time that can be put into more important mechanics. Shown below is a screenshot from the game view, previewing a crate, spikes, the player and a variety of enemies.
Additional Content
FMOD’s integration meant that I could add a variety of sounds into the mix whilst also using my drawn sprites and tiles from photoshop to change the ground, players, enemies and the box. This prototype allows you to toy with the basics of a Platformer.
Test it out yourself following the link below: