Тёмный
No video :(

Godot Recipes: Melee Attack 

KidsCanCode
Подписаться 61 тыс.
Просмотров 112 тыс.
50% 1

How to make a melee attack, such as a sword swing or punch.
Art by Elthen: elthen.itch.io/
Text version: godotrecipes.co...
Support me on Patreon: / kidscancode

Опубликовано:

 

24 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 96   
@grandromusic683
@grandromusic683 5 лет назад
4 Seconds in and he already faces you with your biggest problems... 10/10 Straight forward
@bevvy.bee9
@bevvy.bee9 4 года назад
I absolutely love that
@xzeeno3712
@xzeeno3712 3 года назад
My animation was refusing to play all the way even when I had the playtime longer than the animation. This tutorial fixed everything and now my character is looking spicy
@ccgb92
@ccgb92 5 лет назад
Good lord, the power of the AnimationPlayer. It's simply amazing
@gustavomuller455
@gustavomuller455 4 года назад
Thank you so much, this is the type of tutorials that RU-vid needs.
@soundrogue4472
@soundrogue4472 10 месяцев назад
You are a life saver for showing the actual collision shapes! I just realized my coding issue!
@KruzSanchez
@KruzSanchez 4 года назад
Can you show us the code for the hurtbox and how to set that up?
@andrewjhec1623
@andrewjhec1623 5 лет назад
Your godot tutorial videos are the literal best. I appreciate your work so much. Thank you!
@sherlockrobin597
@sherlockrobin597 7 месяцев назад
I've been grappling with this for two days and you solved it in 5 minutes and 18 seconds. Thanks!
@vast3394
@vast3394 Месяц назад
thanks all the other videos i tried to watch on this made the whole process really complicated, when i just needed to make area2s a child of the sprite. i really appreciate this vide.
@cengizoner9613
@cengizoner9613 5 лет назад
Keep up the great work, Chris! The Godot community is lucky to have you!
@sickle7291
@sickle7291 3 года назад
Good tutorial with good content in only 5 minutes. I really enjoy this tutorial thank you.
@NocturnalMorning
@NocturnalMorning 2 года назад
I know this is an old tutorial now. But, just watched it now. It isn't that useful without an explanation of how to put the Group together to make it work. I tried all the suggestions in the comments, and none of them worked. That said, I still appreciate taking the time to make this tutorial.
@llk3892
@llk3892 5 лет назад
I vastly underestimated the power of animation player when I first started using Godot... wish I had this video back then
@sakealex
@sakealex 5 лет назад
those sprites look pretty damn good I must say, thank you for your work good sir, I've been following you since the python days. I wouldn't say your content is really for young children but as a 30 year old dude I enjoy it.
@EruRoraitoX
@EruRoraitoX 3 года назад
Thanks for quick and clean tutorials
@Comakino
@Comakino 5 лет назад
This would've been really useful when I was coding that - I think I ended up doing something like making a fireball and setting the velocity to zero then animating a sword instead
@dirtyratfinkbastard
@dirtyratfinkbastard 4 года назад
Everything has been super helpful, but I can't figure out how to set up the hurtbox on the enemy's node to talk with the player node. Can anybody help me?
@daniperez4195
@daniperez4195 4 года назад
the wat to do it is putting the "hurtbox" tag on the area2D (that is parent) of the collishion shape you want to detect
@daniel-zh9nj6yn6y
@daniel-zh9nj6yn6y 4 года назад
Put some ads on your videos, I'll gladly watch them. I can't support anyone on Patreon right now.
@andremoraes7067
@andremoraes7067 5 лет назад
hey man! thanks for all of your work
@Kidscancode
@Kidscancode 5 лет назад
ru-vid.com/group/PLsk-HSGFjnaFOLHUcZFHD988Wg39rkopw ru-vid.com/group/PLsk-HSGFjnaFwmOFrfD4gQQqvgvEUielY
@ShuuiTun
@ShuuiTun 4 года назад
How can I do it for the opposite side? :(
@agussetulain5056
@agussetulain5056 4 года назад
I have the same problem :( Can you solve it?
@redandblack641
@redandblack641 4 года назад
I got something like this working, there's one huge oversight that this video didn't mention for the latest version of Godot. Using -1 on the Animated Sprite scale does NOT flip the hurtbox horizontally. Neither does flip_h on the Sprite node. As far as I can see, you have to make a hurtbox for the left and right facing attacks, running a check to see of the Animated Sprite is flipped and enabling the corresponding hurtbox . Everything else is spot on, just baffled but taking this hacky shortcut that no longer works in Godot 3.1.
@Kidscancode
@Kidscancode 4 года назад
This demo was made in Godot 3.1. Scaling any Node2D will also affect its children.
@redandblack641
@redandblack641 4 года назад
@@Kidscancode Whoops, I used a Node instead of a Node 2D and didn't realize that Nodes don't have transform information, but Node 2Ds do. I think that should be mentioned in this video.
@CASMANWHAT
@CASMANWHAT 3 года назад
this channel is a god send! thank you!
@CASMANWHAT
@CASMANWHAT 3 года назад
ps. some requests i have for tutorials - a dialogue system and a turn based rpg :)
@Kidscancode
@Kidscancode 3 года назад
GDQuest has both of those! ru-vid.com/show-UCxboW7x0jZqFdvMdCFKTMsQ
@BlazeXth
@BlazeXth 4 года назад
In case animation and movesets are far more complex than in this case, would it be advisable to have the whole animation part be handled by a different scene that receives input from the player through the character scene?
@drakibble2199
@drakibble2199 5 лет назад
Wow, I wish I knew about this before I started my attack code. Thanks for the tutorial!
@frankovacs4865
@frankovacs4865 5 лет назад
cool idea, waiting for more recipes!
@Kidscancode
@Kidscancode 5 лет назад
I've already added more on the site, just haven't had a chance to record them yet!
@lowpolygon
@lowpolygon 5 лет назад
This answered a lot of my question,thanks
@TitlePending
@TitlePending 5 лет назад
Can you do how to do a fighter game next or at some point? Also, looking forward to new recipes.
@gargoyled_drake
@gargoyled_drake 2 года назад
i do have one issue with this setup, with characters that do melee damage with a weapon, you can't just flip or scale -1 them, you need a different animation for them to keep using the same hand, i know a lot don't care about this, but i do, it's some extra work, and it's even worth it even though 9/10 don't see it or at least call it out, but i bet you that 5/10 will call it out if you don't care about this
@luislodosm
@luislodosm 4 года назад
Very nice and simple
@DrJoe-sm9no
@DrJoe-sm9no 3 года назад
so what would the code for the barrel be- how do the barrel register that it has been hurt?
@MindChamber
@MindChamber 3 года назад
great tutorial..
@adhityarisyad9029
@adhityarisyad9029 4 года назад
oh lord im so stupid, ive been using timer to match my animation with the collision shape hide/show when it could be so much easier. i hate myself
@ZunaZurugi
@ZunaZurugi 4 года назад
Well the worst part about learning an game engine and programming are all those possibilitys you didnt even think of :D
@mechap7612
@mechap7612 5 лет назад
Thank you so much
@woogee513
@woogee513 Год назад
could we possibly get these updated to the newest versions?
@darkfalconage679
@darkfalconage679 4 года назад
How did you made the dummy (barrel)?
@RND-vq3bb
@RND-vq3bb 2 года назад
How to make hurt box?
@trepaning
@trepaning 5 лет назад
excellent.
@pattyorigami
@pattyorigami 4 года назад
I got stuck on trying to get the Area2D's collision box to flip when the character turns around. I was already using flip_h on my character's sprite in my movement script (I'm using a different method than yours here), but my hitbox won't flip even though my sprite does. So how can I easily get it to flip without redoing my whole movement code?
@aZaamBie135
@aZaamBie135 4 года назад
I think you'll have to change scale through code. You don't have to re-write your entire code, you only have to add new lines where your character movement is. I'm also stuck on a problem like yours.
@aZaamBie135
@aZaamBie135 4 года назад
I found a way to fix it! The code is: $Sprite.scale.x = -1 ( if your character is moving to the left) and $Sprite.x = 1 (if your character is moving to the right) Try to add that to your script
@emaleth6518
@emaleth6518 5 лет назад
Similar thing can be done without animationplayer. You just need timer to set for how long area2d should be active :)
@minebrostj1430
@minebrostj1430 5 лет назад
Emaleth very true, however the animation player adds the convenience of seeing exactly when something will occur in an animation and being able to easily edit it for new animations aswell. I used to use the timer method myself and I hate myself for it now because this is so much easier XD
@emaleth6518
@emaleth6518 5 лет назад
@@minebrostj1430 yes, but if you like me have already player done and then you want to add melee, well... for me at least, as a beginner, it was simpler.
@minebrostj1430
@minebrostj1430 5 лет назад
@@emaleth6518 yeah I agree, that's why I used timers in the first place, I'm working on transferring it all to the animation player now.
@mikhail6729
@mikhail6729 5 лет назад
Thank you for your tutorials. I wasn't able to find information about "advanced condition" in state machine transition. Is there any way I can do that?
@sohaslyn612
@sohaslyn612 2 года назад
wow i wonder why you didnt get million sub
@faikyesilyaprak8761
@faikyesilyaprak8761 4 года назад
Hello, I need help. Could you help me to put an enemy character which I can attack and he will die ? I could not do it. I created my character but I could not set collasion.
@herc34es
@herc34es 2 года назад
This doesn't seem to work with the animatedSprite note; right? I was trying but could not figure it out....
@IgorogI1000
@IgorogI1000 4 года назад
Great!
@marciopaulo1708
@marciopaulo1708 Год назад
How to do with the character's weapon separate?
@Khusyasy
@Khusyasy 3 года назад
very helpfull, thanks
@tohut6307
@tohut6307 3 года назад
Can somebody help me when I run and start attacking it says "nonexistent function in _group in base Area2D ?
@Kidscancode
@Kidscancode 3 года назад
The function name is "is_in_group()"
@lemongummy7047
@lemongummy7047 4 года назад
I'm having trouble to do it in 3d :( guess I'll go back to 2d..
@Anonymous-jo2no
@Anonymous-jo2no 5 лет назад
Umm... WTF is group?
@daniel-zh9nj6yn6y
@daniel-zh9nj6yn6y 4 года назад
I think it's a category of objects that can be hurt (enemies) or destroyed (barrels, treasure chests).
@anixma12
@anixma12 5 лет назад
Thanks, I watched your video and I see that you implement an AnimationPlayed and a basic Sprite, I ask you, how could I do the same using an AnimatedSprite? I already have several animations that way, but I can't find a way to integrate what you do with what I have.
@Kidscancode
@Kidscancode 5 лет назад
You can't do this with AnimatedSprite. The AnimationTree state machine works by controlling AnimationPlayer nodes. AnimatedSprite is not very sophisticated - it's a much simpler form of animation.
@tonywithani
@tonywithani 4 года назад
I enjoy your tutorials. They are extremely helpful. Are there sample file available for the project on github?
@Kidscancode
@Kidscancode 4 года назад
Not really, as this was a mishmash of a project that I made to demonstrate a few different things.
@tonywithani
@tonywithani 4 года назад
@@Kidscancode Thank you for replying
@soundrogue4472
@soundrogue4472 10 месяцев назад
Maybe I missed something but did you have a script in the area2D or something? It's not exactly working.
@Kidscancode
@Kidscancode 10 месяцев назад
Yes, you can see it in the written version: kidscancode.org/godot_recipes/3.x/animation/melee_attacks/
@soundrogue4472
@soundrogue4472 10 месяцев назад
@@Kidscancode I solved my problem; getting variables from the said area 2D since the damage dealing function is interacting with the area 2D; I found a way to pass the info to the main body of the player.
@commentingexistentialcrisi9564
@commentingexistentialcrisi9564 4 года назад
I have a problem with using signals, the problem is that they only emit the signal once they enter an area and not while in the area. Any solutions?
@Kidscancode
@Kidscancode 4 года назад
That is how the `area_entered` signal is supposed to work. If you want to continuously check, use a variable to keep track of the body when it enters, and then reset that variable when it leaves.
@commentingexistentialcrisi9564
@commentingexistentialcrisi9564 4 года назад
@@Kidscancode oh thanks
@w4yzet
@w4yzet 3 года назад
спс
@ayrton_x2447
@ayrton_x2447 3 месяца назад
In godot 4 please :D
@Tesla7
@Tesla7 4 года назад
how do we get the sprite into the animationplayer?
@hunterrayz5407
@hunterrayz5407 4 года назад
I might be making myself look stupid but uhhh......... how did you make the hurtbox?
@Kidscancode
@Kidscancode 4 года назад
It's an Area2D.
@hunterrayz5407
@hunterrayz5407 4 года назад
@@Kidscancode Is hurtbox the name?
@Kidscancode
@Kidscancode 4 года назад
Yes.
@hollowvoide6567
@hollowvoide6567 2 года назад
how do you do it with 3d?
@Kidscancode
@Kidscancode 2 года назад
In pretty much the same way. Use Area instead of Area2D, etc.
@osloyy
@osloyy 4 года назад
how do you do this with the AnimatedSprite node?
@Kidscancode
@Kidscancode 4 года назад
You couldn't use this technique with AnimatedSprite, as it only controls the displayed texture. AnimationPlayer is capable of much more than that.
@giuseppefontana5471
@giuseppefontana5471 4 года назад
can we use the same technique with AnimatedSprite?
@Kidscancode
@Kidscancode 4 года назад
AnimatedSprite can't enable/disable the collision shape.
@giuseppefontana5471
@giuseppefontana5471 4 года назад
@@Kidscancode thank you for the quick reply. I'll try with AnimationPlayer
@poisonicecream4916
@poisonicecream4916 3 года назад
Hmmm
@viniguerrero
@viniguerrero 5 лет назад
Awesome video! Best explanation possible for a real time game ;) Keep it up #VaiBrasil
@codelazy2855
@codelazy2855 5 лет назад
I don't know how you did it. There was no collision trigger on my version (3.1.1), so I submitted a bug. If you can provide a Godot project demo, I'll see if I missed anything. github.com/godotengine/godot/issues/28803
@potatopen5282
@potatopen5282 4 года назад
Can you make a gun tutorial? Something like enter the gungeon, but with Godot. There are no good tutorials on guns, would love it if you made one!
@Kidscancode
@Kidscancode 4 года назад
There are lots of good tutorials on creating different kinds of projectiles. See the official godot-demos, GDQuest, GameEndeavor, etc.
Далее
Godot Recipes: Car Steering
20:55
Просмотров 46 тыс.
6 Tips to Better Organize your Godot Projects
11:39
Просмотров 134 тыс.
When AI Plays Wordle..
21:49
Просмотров 40 тыс.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
Просмотров 511 тыс.
I Made a Desktop Pet in Godot
16:02
Просмотров 121 тыс.
How Games Make VFX (Demonstrated in Godot 4)
5:46
Просмотров 337 тыс.
Make Video Games
44:12
Просмотров 1,2 млн
HD-2D Style in Godot 4.1
12:57
Просмотров 50 тыс.