-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attack hitbox and startup frame refactor #134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick, light review and it looks good to me.
I like that we've moving things into a more generic Projectile/Melee attack systems with less item specific systems. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 😄
commands.entity(entity).push_children(&[attack_entity]); | ||
//TODO: define hitbox size and placement through resources | ||
|
||
//maybe move audio effects? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly! It depends on what you have in mind 😄
Maybe adding a system that matches the current on-screen animations? I haven't checked the system, in this case, they'd need to be connected to a state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I have anything in mind yet, just noting that it feels a bit awkward that it lives here, I think this might make sense to either trigger based off attack actionlike state or when we split out the movement intent from attacks also use a similar strategy to split out the sound triggering intent of attacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Difficult to say 🤔 The reason is that this is already a decoupled logic - FighterStateEffectsPlayback
does not play any effect itself, but it adds a component, in turn this component is picked up by a separate system (fighter_sound_effect
).
Having said that, I definitely find ugly the surrounding conditionals. They can be offloaded to the fighter_sound_effect
system, by passing the Handle<FighterMeta>
, so that the audio system can find out the asset by itself. On the other hand, this design leads to one system is saying to another "here's the metadata; maybe you'll play a sound, maybe you won't". This can be fine, it's a matter of taste.
Let me know if you have any preference, since I think all the approaches are equally valid.
bors +r |
Did you mean "r+"? |
Did I ? 😆 |
bors merge |
Build succeeded: |
Haha, check it out, bors actually merged both of our pull requests into a single merge commit because we tried to merge it at the same time. That's cool. :) |
Closes both
#53 #54
Collisions have been refactored to take place in one system only, the filtering we need is already done via
BodyLayers
.There are now two main types of attacks.
1. Melee attacks: these are spawned as a child of the fighter who starts them, with an
AttackFrames
component which consists of the startup active and recovery frames of the attack. These correspond to the frame window in which a hitbox is spawned, which will collide with other fighters as defined by its collision layers. Melee attacks are not despawned when they collide with something, instead they stay active for the duration of their Active Frames. There are systems which activate the hitbox at the start of the Active Frames and despawn the attack at the end of the Active Frames/Start of the Recovery Frames. These attacks also lock the fighter into theAttacking
state for the duration of their attack animation.2. Projectile attacks: these are spawned un-parented, and with a
ProjectileLifetime
component. They are despawned on collision, or upon reaching the end of their lifetime. Currently only the player has these, and they do not lock the player into an attack animation, although I think ultimately both of these things will change, players and enemies will both want projectile attacks and they will be tied to either character specific special attacks or Ranged Weapon animations.Things to consider for this PR:
AttackFrames
component. I want to stick with these names but I see the way they are referenced currently could be confusing, currently they are the index relative to the animation on which the startup, active, and recovery portions of the attack end. I also considered representing them as ranges, but it seemed like an index was simpler.Further improvements
(I intend to do both of these)