hey how would u make hitboxes for an entity that has animation? for example in a fighting game, u have many animations and hitboxes too so just disable unused hitboxes will be a pain, i have thought about using animation player too but same problem, i said still have to disable the unused hitboxes and enable used hitboxes. please tell me the general way of doing this. TYSM!
#how to make hitboxes for animation
1 messages · Page 1 of 1 (latest)
My first thought would be to make each move a resource and put all the data about the move in the resource then make a new “move hitbox handler” node that uses the data given by the resource and creates area 2ds accordingly
Hard part would be making the move hitbox handler node deal with all the stuff you wanted to add to the move
Idk maybe make each move a scene? But that also seems weird
Idrk fighting games are hard
I guess you could also just repeat this for all the other parts of the move
Put the animation name in the resource and tell the animation player to play it
Put the duration in the resource and tell a character state manager to not do anything while the move is working
Character calls attack function
Attack function calls hitbox handler function and passes in the resource
Hitbox handler creates area 2d,gives it a shape, gives it a position,size,signal,etc
Hitbox handler makes sure that after a set amount of time the hitbox gets freed
Unrelated but i have seen people use animation players but this doesn’t work well with how fighting games work fundamentally as it means the moves come out depending on the time after a move is pressed instead of a set amount of frames later
(And also runs into the issue you mentioned of way too many damn areas)
Most of godot works this way too
Makes making balanced consistent fighting games near impossible unless you write a lot of code
I’ve seen a few frameworks though, idk if it would help, I’ve never tried them
Found a video I watched recently
Right of Way is my fencing-based 2D fighting game. Notice how it's "fencing-based"? Well, NONE of my friends decided to use the fencing character I spent a whole summer on! They all loved Miyamoto Musashi, the samurai character. So, I spent the past 7 months working on him--and 3 stages and systems mechanics and new camera code and a lot of VFX ...
16:31
He shows his animation player and has his attack and body as 2 polygons
Meaning he can just change the shape in the animation player
But still this wouldn’t line up with how fighting games work fundamentally with frame rate as I don’t know any way to make animation players use frames instead of time
Unless he’s incrementing the time by .0166… every frame and froze the animation player
Man I’m yapping
1 more thing
Damn couldn’t find it
But yeah if you’re serious about making a good traditional fighting game I’d recommend you try 2d fighter maker (I heard they’re still kicking pretty well and I’ve tried a few pretty decent fighting games thatve used it)
What are the odds you’re not even making a fighting game and I geeked out for nothing 
Hello mate, I'm sorry for late responding 😞. After the post, I gotta got for some emergency but thx for ur dedication mate. I can see u have put a lot of effort in ur messages. Thx u so much again!
Not sure how your animation is setup, but if you can get the animation name and frame, then you can use a resource/dictionary to load hitbox transforms for the given animation frame.
If you are going to adjust hitboxes by hand for each frame, you can setup the editor to quickly save the shape transforms to a file for each frame.
Or there's the crazy pixel-detection method, that checks for collisions visually, but you probably need to specifically design around that.
im not making fighting game but im curious about how they handle a large amount of hitboxes and hurtboxes in fighting game but with godot
and like in one character's attack animation is there sometimes that some of the frames have not the same amount of boxes as the other frames?
and how do they handle that?
I would probably not do so much work in a resource -- you're effectively building tools like animationplayer (etc) from the inside out if you do that, since you have to make the animation... and make the hitboxes... and then link them together from outside.
I would make each move be a standalone scene which is either instantiated the whole time (I wouldn't!) or instantiated when- and while- it is triggered (I would!), with a separate component responsible for managing the triggering.
This can contain its own nodes (including new hitboxes, synched to its internal animation...)
but can also refer to resources from outside that are the responsibility of the triggerer to provide (like: the character's own node tree, to animate their movements from inside this move animation)
ur saying like idle would be 1 scene then attack would be 1 scene?
tysm!
Right, the tree would end up being smth like:
CharacterBody
\ CollisionShape # for platform/wall detection
\ Sprite2d
\ Hurtbox
\ Colshape # for getting hit
\ MoveManager # Knows about the moves, listens for their gestures. Here, each move _might_ be resources -- move name, move input, move scene <-- this scene has all the actual "do the move" logic, so you can design it all in-editor
\ Hadouken [scene!] # instantiated by the manager, reference up to the charbody & colshape...
\ AnimationPlayer # likely the target is charbody!
\ Spawner # Just as an example, adding more stuff to the scene
\ Fireball [scene!]
\ Hitbox
\ Colshape
\ Sprite
\ AnimationPlayer... # Managing the fireball's animation & hitbox
# You'd never see these at the same time, but just to show "nothing up my sleeve", here's how the "walk" move would look
\ Walk [scene] # still instantiated by manager
\ AnimationPlayer # managing the charbody, hurtbox & its colshape.
# or...
\ LPunch [scene]
\ Hitbox
\ Colshape
\ AnimationPlayer # managing charbody, hurtbox, and this hitbox & its colshape