This is a basic 2D platform I created in order to get practice working with c# programming in Unity. Below I detail some of the code and its applications in respect to the game.
Here are some Private variables I plan on using in my code to help move my player object throughout the world and interact with various entities. Notice the SerializeField declaration in front of several private variables in order to ensure those variables remain private but also show up in the editor.
Notice the update function is called once per frame to change the velocity and direction of the player object to the current state, which is determined by the keys being pressed.
The State switch function helps to change the character animation of the player object in the scene depending on the current state. The state is determined by either the velocity of the player object or whether or not the player object is on the ground (2D Collider field is used to determine contact between 2 rigid bodies, namely the Player object and the Ground).
This function helps materialize the interaction with other objects, such as the enemy frog in the game.
A Note from Umar
I avoid simply placing my computer science projects on GitHub. I personally believe that GitHub doesn't do as well of a job as showcasing the process of constructing a computer science project as a portfolio would. Therefore, I aim to display all my personal and internship projects on this site, showing not only my code but also my thought process in constructing the program.

You may also like

Back to Top