To start with this EEP Project, I wanted to create some basic sprites for a player character for a Unity platformer. First, I decided on a style in mind and chose a 2D-pixel art style. While my art skills are not the best, I still wanted to try making sprites. This project is more of an experiment of my pixel art and animation skills.
Down below are all my player animation sprite sheets:
For the second day, I had a few plans and wanted to get a good chunk of work done. first, I wanted to get a scene together for the game to have a world. Then I wanted to focus on incorporating player mechanics, with a focus on the player movement and the animations. I want to use the animator for the animations because although it is slightly more complicated, it can lead to more efficient and easy work with animations. For the mechanics I want to focus on how they feel, making sure they feel good to use and allow the player some freedom. some of the basic things this player system needs are Basic Movement, Sprinting, Jumping, and Air control. On a later day, I could add more jumps and add features like coyote time, this would add polish.
For the movement, I created a script that would handle the player inputs and convert them into movement. For the movement, I wanted to focus on adding in the basic stuff, so I added some basic floats for the movement variables. For the movement I get the horizontal and vertical inputs in the update function, I will use these to get the players' inputs. Then in a function to handle input, I use the horizontal input to add velocity to the player's rigidbody. To add Air control I create some variables for the air control. Then if the player is grounded I apply the air control to the velocity.
For the on-ground bool, I send a ray cast down to check for a ground floor. If this is true that means the ray cast has detected a ground if not abilities like jumping and air control will be disabled. In the handle movement, I make sure the player's sprite is flipped based on the direction the player is going. This is not useful now but it will come in handy when the player is animated. To get jumping working I add the is grounded to a handle jump function. If the space key is held down and the player is grounded I add force to the player's rigidbody using the jump force. I set some bools to true or false based on if the player is jumping.
For the animations i added them into unity and set them in a tree. I made sure they were all connected right taking quite some time with my final animator looking like this:
For the animation, the code can be hard to explain for the most part the animations is just setting bools and floats. The attack has cooldown floats to control the player's attack speed. There is a function that resets the animator. The attack right now has no other function than setting the attack animations but I will change that. lastly, I added the hit-and-death animation, this took a while to get working but overall got to a good place.
To start on the third day I wanted to work on getting some extra features to the platforming. This would allow the player to have more interaction in the world, allowing them to feel like they have more to explore. The features I would like to add are ladders and passthrough platforms. To start with these I create some sprites and import them into unity. After this, I add them to some game objects, which allows me to add the components that allow ladder and passthrough. For the ladder, I will add the code to the player movement and for the platform, I will just add a script to the object.
For the ladder I send up a ray cast, If this hits it will allow the player to climb. Then I made it so that depending on what the ray cast is interacting with the player can climb or not. If the player is climbing then the script adds changes the player's velocity using the vertical inputs. For the platform, I made it so that if the player presses a certain key it rotates the effector. The effector is in control of what side the player can collide with.