How to Make a 2D Melee Attack | EASY Unity Tutorial
Ойындар
Show your Support & Get Exclusive Benefits on Patreon (Including Access to this project's Source Files + Code) - / sasquatchbgames
Join our Discord Community! - / discord
By the end of this unity tutorial, we'll have our character damaging enemies using a scaleable 2D melee combat system, where you can control the EXACT timing of when damage is applied to enemies based on the animation of your attack (giving you full control.)
I'll also show you how to include Gamepad support, because using the keyboard sucks!
Link to Download the FREE 2D Asset Pack seen in this tutorial:
veilofmaia.com/tutorial-asset...
---
In need of some Unity Assets? Using our affiliate link is a great way to support us. It's free, and we get a small cut that helps keep us up and running: assetstore.unity.com?aid=1100lwgBQ
---
Contents of This Video: ------------------------------------------
00:00 - Setup and Import
02:30 - Starting to Code the Attack
05:34 - Implement Damage Interface
09:35 - Creating the Attack Animation
12:57 - Implement Time Between Attacks
14:15 - Redoing the Attack Properly
17:22 - Fixing the Damage Function
Who We Are-------------------------------------
If you're new to our channel, we're Brandon & Nikki from Sasquatch B Studios. We sold our house to start our game studio, and work full time on building our business and making our game, Veil of Maia.
Wishlist our Games:
Wishlist Samurado on Steam! - store.steampowered.com/app/23...
Wishlist Veil of Maia! - store.steampowered.com/app/19...
Don't forget to Subscribe for NEW game dev videos every Monday & Thursday!
Follow us on Twitter for regular updates!
/ sasquatchbgames
#unitytutorial #unity2d #platformer
Пікірлер: 19
Improvement Note: In the DamageSlash Coroutine, the check: if (iDamageable != null && !iDamageable.HasBeenDamaged) can be changed to: if (iDamageable != null && !iDamageables.Contains(iDamageable)) - this will allow you to delete the HasBeenDamaged bool from the iDamageable interface (you'll need to get rid of it in the enemy Damage functions as well,) AND - this will allow you to get rid of the foreach loop that runs after the coroutine is finished (but the list still needs to clear) Faster and easier to read/implement this way.
It needs to be stated, while other systems show a simple approach to do something (create a collider and connect colliders, etc) the system you show feels very robust and the various additions, while they add some scripts and functions for checks, are a diamond in the rough as far as going all the way to show the full implementation, not just the face layer of something like an attack. Your state machine videos were testament to that. I am reworking my attack system and while I plan to do implement a touch different (top down 2D), the thoroughness that goes into these videos is not unnoticed. 👌This should be a 500K sub channel. Someday.
Excellent tutorial, keep them coming!
Good tutorial. Thank you.
@sasquatchbgames
Жыл бұрын
Glad you liked it!
Thanks for the tutorial, in particular with the while and animation event in the coroutine attack. Just a question. My attack have a vfx effect with particle (I use a prefab with the texture sheet animation). Is it possible to launch the script with a particle event to replace the animation frame event ?
For ideas, Top down mouse directional melee combat would be cool. the code monkey guy has one but its hard to follow and he leaves alot out of it.
good
you write and change window so freaking fast that i need to rewatch the last minute every minute...At least that's good for the timewatch of the video 😭😭
Bro i have a problem: PlayerAttack.cs(16,12) error : The name "User Input" does not existe, in the current context. Do you have any idea on what could i do? thanks
@Sgt_Killersnow
Ай бұрын
This looks like you might not have switched to the Input System and made a script called User Input to control what button maps and control schemes your project will use and when. I'd recommend watching his video going over the Input System! his script names change a bit between videos so I think he starts it off as PlayerInput and then later it becomes User Input, etc etc.
says its easy and here I am 3 hours later finding out that this sht aint working for me and just quit!
First
@sebastianhall8150
Жыл бұрын
First on this comment
@wabbit_07
Жыл бұрын
@@sebastianhall8150 First reply to this reply on this comment
@sasquatchbgames
Жыл бұрын
First to reply to the reply to this reply on this comment
@Coco-gg5vp
Жыл бұрын
What have I started
@redrad14
Жыл бұрын
Not first