- Make Character Move
- Collect Items
TECHNOLOGIES, TOOLS, AND RESOURCES
- Visual Studio
Create a 2D Character Controller and a player movement script.
The 2D Character Controller will use to add movement and jumping to the characters, while the player movement script is used to control the character via Inputs. Separating these two allows the character controller to be used by AI. The Character Controller uses rigid body physics to control the character movement by adding force, this is used to make sure collision works as intended. This script also informs the direction the character is moving and as such flips, the characters transform accordingly.
The other task is to make collectable items, for this, I used simple trigger collision on the object, Each collectable test to see if the player is within the trigger volume it then tells the player what it needs to know such as if to add an item or to increase health then the item plays an animation and then at the end of that animation the item is destroyed.