
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/
Explore a quick crash course in building a top-down 2D action RPG in Unity, using the mystic wards asset pack and starting a new 2D project in Unity Hub.
Install and enable the new Unity input system, create a player input actions asset, attach a player input component, and implement an on move handler using fixed update for movement.
Install Cinemachine, add a virtual camera to follow the player, and apply the pixel perfect extension to smooth motion.
Create a slime enemy and implement sword hit detection using a trigger box collider to deal damage, track health, and defeat the enemy when health reaches zero.
Wrap up the first part of this top-down 2d action rpg crash course in unity, covering player movement, collisions, and tile map setup, with slime damage as a next step.
Downloadable in this video is the starting point for part 2. You should download it to follow along in this part.
Read the movement input vector and apply it to a dynamic rigidbody, clamp speed, flip the sprite when idle, and set animator parameters to switch between idle and run.
Plan attacks with a one-time trigger from the Unity input system; bind fire to left mouse or right control, then trigger a sword attack in the animator and lock movement.
Set up a slime enemy in Unity by creating a sprite prefab, adding dynamic Rigidbody2D with gravity off and collider, and wiring an animator controller with idle, run, hit, death.
Tune slime and player physics in Unity 2022 by adjusting linear drag to create ground friction, observe idling dynamics, and apply prefab changes for consistent behavior.
Learn to flip the sword hitbox with the player's facing direction using local position offsets and a directional callback, enabling precise hits and slime knockback.
Calibrate knockback force and direction in Unity by tweaking mass and linear drag, using collider positions to control force direction. Implement a targetable flag to disable collider after death.
Disable movement on defeat by toggling targetable and rb.simulated, apply to the prefab, and differentiate behavior for the player and slimes when entering a death state.
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 to move a 2d top-down character in Unity by applying forces instead of setting velocity, and tune knockback, linear drag, angular drag, and speed for responsive combat with slime.
Fade the text by adjusting its alpha from the starting color as time elapsed approaches time to live, updating every frame with the text mesh color assigned in the inspector.
Instantiate a health text prefab and attach it to the canvas with Text Mesh Pro. Place it above hit character using world-to-screen coordinates and gate movement via targetable property.
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.