Skip to content

Commit

Permalink
fighters can now enter throw states from grab idle
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Oct 10, 2020
1 parent f541351 commit 44fa7c1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions canon_collision/src/entity/fighters/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,23 @@ impl Player {

fn grabbing_idle_action(&mut self, context: &mut StepContext, state: &ActionState) -> Option<ActionResult> {
self.apply_friction(context.entity_def, state);

if state.frame_no_restart > 60 { // TODO: additionally check if grabbed player is still in a grabbed state
if (context.input[0].stick_x <= -0.66 && context.input[1].stick_x > -0.66)
|| (context.input[0].c_stick_x <= -0.66 && context.input[1].c_stick_x > -0.66) {
ActionResult::set_action(PlayerAction::Fthrow)
}
else if (context.input[0].stick_x >= 0.66 && context.input[1].stick_x < 0.66)
|| (context.input[0].c_stick_x >= 0.66 && context.input[1].c_stick_x < 0.66) {
ActionResult::set_action(PlayerAction::Fthrow)
}
else if (context.input[0].stick_y >= 0.66 && context.input[1].stick_y < 0.66)
|| (context.input[0].c_stick_y >= 0.66 && context.input[1].c_stick_y < 0.66) {
ActionResult::set_action(PlayerAction::Uthrow)
}
else if (context.input[0].stick_y <= -0.66 && context.input[1].stick_y > -0.66)
|| (context.input[0].c_stick_y <= -0.66 && context.input[1].c_stick_y > -0.66) {
ActionResult::set_action(PlayerAction::Dthrow)
}
else if state.frame_no_restart > 60 { // TODO: additionally check if grabbed player is still in a grabbed state
ActionResult::set_action(PlayerAction::GrabbingEnd)
} else {
None
Expand Down

0 comments on commit 44fa7c1

Please sign in to comment.