For this platformer I used a collection of premade assets. I only need to use one script for the platformer which controls character movement. I start off by declaring my variables.

playerSpeed stores the speed in which the player moves, playerJumpForce controls the force in which the player jumps with and moveInput detects whether the player is pressing the left or right arrow keys. Rigidbody2D acts as a reference to the rigidbody and SpriteRenderer acts as a reference to the spriterenderer. The next four variables are explained in the screenshot so I won’t explain them here. jumps detects the number of jumps that the player has input before hitting the ground.

After declaring my variables I do a void start function as shown in the image above. This function gets the Rigidbody2D and SpriteRenderer components.

After this I do a void FixedUpdate function as shown in the image above. This function sets the boolean isGrounded to be true if the groundcheck circle overlaps with the ground. This function also includes code to flip the player if they move in the opposite direction to what they are facing. I’ve also added an if statement that makes it so that if the player is grounded, they can only jump once.

I’ve added a very basic level as shown in the image above.
There are many things that I can do to improve my platformer. First of all, my character still gets stuck on walls, so I can work on fixing that. Another thing I can add to make the game more interesting are some hazards as currently, there is no way to die in my game. I would also like to add a walking animation to my character to make the game more visually interesting.