-
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
Boss Bomb Throwing #272
Boss Bomb Throwing #272
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.
Ok Its looking pretty good I think, might do another pass tomorrow but 👍
ItemKind::Bomb { .. } => { | ||
panic!("Can't throw bomb") | ||
} |
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.
It might be interesting to come back in future and make it so the player can pickup and throw the bomb before it explodes.
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.
For sure, I thing the only problem is that the bomb stays "fusing" for I think 0.36 seconds, so not much time to grab and throw it now, but it for sure makes some fun gameplay
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.
yup, I was thinking we could change the duration potentially or have it extend a bit if picked up fast enough.
#[derive(Component, Clone)] | ||
pub struct Explodable { | ||
pub attack: AttackMeta, | ||
pub timer: Timer, | ||
pub fusing: bool, | ||
pub animated_sprite: AnimatedSpriteSheetBundle, | ||
pub explosion_frames: AttackFrames, | ||
} |
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.
Does explodable need to have its own AttackMeta
and AttackFrames
?
AttackMeta
already has its own AttackFrames
but couldnt Explodable
be a component with only timer
and fusing
and animated_sprite
?
Then add the Explodable
component to an entity with an AttackMeta
and query for both when you need to deal with both.
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 about the other thing you said, but we need two attack frames actually, one for the bomb explosion, and one for the frames the boss throws the bombs
src/attack.rs
Outdated
if let Ok((animation, explodable)) = explodable_query.get(**parent) { | ||
if animation.current_frame >= attack_frames.startup | ||
&& animation.current_frame <= attack_frames.active | ||
{ | ||
commands.entity(entity).insert(Collider::cuboid( | ||
explodable.attack.hitbox.size.x / 2., | ||
explodable.attack.hitbox.size.y / 2., | ||
)); | ||
} | ||
} |
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'd like to avoid special casing this activation code, I've done a bit of a refactor, added the hitbox metadata directly to Attack
now which should let you remove this extra query and block if you add a With<Explodable>
to the or tuple on the parent_query
.
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 think its good for now, maybe we can revisit after next release to see if we can simplify anything further
bors merge |
Implements boss bomb throwing
Closes #269