2D Platformer

2024Unity C#

This is my very first Unity project! I embarked on the journey to learn Unity as I followed section 3 of this Udemy course and made my first Unity game. Creating something by following a tutorial is easy, so when the tutor was finished with the game, I challenged myself to add some extra functionalities in the game and test my newly learned skills.

Here's the full gameplay:

Links

Extras

I designed the level by myself after I learned how to create one and add new features in the game to apply the knowledge I learned in section 3 of the course.

  • added a frictionless wall (BoxCollider2D) on the far left side of the level to prevent the player from falling off the ground, but the enemies and gun shots can go through that wall.
  • created a wave animation for the water bodies between the grounds to add a dynamic feel in the game.
  • created checkpoint system in the game so when the player falls off the ground or drowns in water, the player moves to previous checkpoint with one less life.
  • added multiple sound effects: one to play when the player falls or drowns, second for player walk, third for player jump, and a couple others to play when the player wins or loses the game.
  • added a couple of background music in the game with one as the normal and the logic to switch to another when the player triggers the boss checkpoint.
  • created life bar UI for boss to let the player know how many hits are required to win the game.
  • used the 'Spikes' sprite from the course-provided tileset to add a little bit of extra challenge for the player.
  • wrote a basic controls guide on the main menu of the game.

Learnings

I learned:

  • about the prefabs and their usage in the workflow of game development.
  • about various types of components in Unity such as BoxCollider2D to simulate collision and RigidBody2D to simulate physics.
  • about sprite sheets and slicing of individual sprites when sprite mode is set to 'multiple'.
  • to use C# scripts as components in Unity and give life to game objects.
  • to use Input class and its methods to handle input in the game.
  • about Animator component and to create animation clips for game objects.
  • to use animation events and perform a task in-between keyframes.
  • to create clones of game objects from their prefabs using Instantiate method.
  • about UI system of Unity and add buttons, images and text in the game.
  • about Camera and its properties, and how to make camera follow the player.
  • to use layers and LayerMask for detecting collisions.
  • to use tags and use them in C# scripts to find game objects.
  • about properties like 'Sorting Layer' and 'Order in Layer' to set the order of appearance of game objects.
  • to use AudioSource component and add music and sound effects in the game.
  • to create and manage multiple scenes.
  • to apply doppler effect in audio.

Screenshots

Water wave effect is created by deactivating and cloning water game object.

The invisibile wall at far left of the level to prevent the player from falling off.

CloseGo to previous imageGo to next image
Expand image