2D Basic Character controller (MetroidVania/Platformer)
Important: Made with Unity Editor 2021.3.0f1, some tile sprites go missing when Importing to later versions in which you have to manually update the tile sprite images and the sprites for each of the Player animations.
A and D to move. S to CROUCH, SPACE to jump & double jump. LEFT CONTROL to attack. LMB to Turn On/Off torch. ENTER to respawn
K to set player position as enemy target position
L to set current enemy position as enemy target location.
- This package is for basic 2D platformer movement, however it can be easily modified to a 2D top-down environment by including the VerticalAxis input.
- The animation system employs the use of blend trees to change direction of the animation by setting the float parameter "horizontalDirection" in the PlayerControl script.
This can be easily modified to a top-down environment by including another float parameter "verticalDirection" and using a 2D Simple Directional blend type to set the animations for each direction.
- This package includes:
- Player movement: walk, jump, fall, melee attack, death, respawn
- Separate PlayerAnim script with public methods to set animation booleans, floats and triggers
- Player can deal damage to objects with Tag "Obstacle" or "Enemy"; can be added to in the inspector by adding a string to the attackableTags field of the PlayerControl script
- A DamageDealer script that can be attached to any object that will cause damage to another object and uses a public function DealDamage(float targetHP) to reduce the target's health
- PlayerAttack script that handles the logic of a melee attack. Can easily be modified to include projectile/throwable attacks
- HandleDamage script for the player; DamageHandler script for everything else that can take damage
- Obstacle that can take damage and be destroyed when HP reaches 0 or less
- Health script that stores the health float of the gameObject and a PlayerHealth script which inherits from Health and controls the health bar UI of the player
- GameManager script that caches a reference to the Player gameobject that can give other scripts access to all scripts attached to player
- Very basic spritesheet and tilesheet
- (NEW!) Basic enemy movement system based on the NavMeshPlus extension (inlcuded in package) created by h8man.
(NEW!)Update (02/12/2023):
- Refined Jump controls and added PlayerAbilities script to control when player unlocks abilities such as Crawl, Wall slide & double jump (included these abilities in player controller script and can be activated in the inspector)
- Updated Player animations and Tilesets (4 different "Biomes" and 2 different colored bricks)
- Added Door & Key system
- Added Torch that points in the direction of the mouse and will only affect the "Dark" sorting layer
- Added basic Cinemachine Follow Cam
https://github.com/h8man/NavMeshPlus
- Planned Updates:
- Enemy Movement using NavMesh (free)
- Enemy Patrol inheriting from EnemyMovement (in $2 package)
- Enemy Attack (in $2 package)
- Enemy Animator in Unity and EnemyAnimation script (in $2 package)
NOTE: This asset was made with Unity Version 2021.3.0f1 using the 2D URP template and so if you open the Demo scene and are unable to see the sprites, make sure you have the URP asset installed in your project.
Any questions, comments or bugs to report can be sent to my email oliveirawood23@gmail.com
Enjoy! :D
Status | In development |
Category | Assets |
Author | 3rdCulture |
Made with | Unity |
Tags | 2D, Characters, Controller, Unity |
Average session | A few seconds |
Inputs | Keyboard |
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.