
A brief look at what to expect over the content of this video course.
Finished versions of the course assets and scripts downloadable below!
Music: Summer Ambient Piano by Rafael Krux
Free download: https://filmmusic.io/song/5504-summer-ambient-piano
License (CC BY 4.0): https://filmmusic.io/standard-license
Artist website: https://www.orchestralis.net/
Downloadable in this video is the starting point for part 2. You should download it to follow along in this part.
I've been experimenting and I find one way is to increase the linear drag on the rigidbody set in Dynamic mode. Instead of the Lerp to 0 (removing those lines entirely), you can set the rb.drag to a higher amount to get it to stop faster (Stop drag vs moving drag as 2 different variables for different character states). This lets the knockback apply more correctly. So for movement...
// Move animation and add velocity
// Accelerate the player while run direction is pressed (limited by rigidbody linear drag)
rb.AddForce(moveInput * moveSpeed * Time.fixedDeltaTime, ForceMode2D.Force);
And in the scripts where you apply force to the player
// Apply force to the slime
// Impulse for instantaneous forces
rb.AddForce(knockback, ForceMode2D.Impulse);
Letting the linear drag handle the knockback lets the rigidbody physics smooth out the velocity between the normal run and the knockback impulse.
Learn the basics on how to build a Top Down 2D Action RPG (think classic Zelda games) inside of Unity 2022. The main focuses of this course is on creating a working player with a sword attack, a slime enemy to chase and damage the player, and building a level to play on with pixel art tilesets including wall collisions. Another key focus is demonstrating the differences between kinematic physics and unity dynamic rigidbody physics with two versions of the player controller script so you can choose which method works best for you and your own games. Also important is the cinemachine package for creating a follow camera to track your player but maintain pixel perfect settings in Unity to avoid any screen tears or distortions.
In this course, we'll cover much of the core gameplay essentials games in this genre will need in their main gameplay cycle
Player Movement and Attacks with new InputSystem package
Building Tilemaps from Tilesets
Movement with Kinematic and Dynamic Rigidbodies
Making a Slime Enemy which can chase player, cause damage, and be slain
Setting up animations and transitions with Unity animation state machines
Creating hitboxes for directional attacks
Floating Damage Text numbers
Everything is written in C#, the standard language for unity games. You don't have to be a programming master. If you get stuck, feel free to download the finished scripts included in this course so you can get up and running.