Skip to content

Commit

Permalink
Disallow moving aim while firing
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Oct 8, 2024
1 parent 89267f4 commit 7e38bd2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/entities/playable/worm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ export class Worm extends PlayableEntity {
if (inputKind === InputKind.Fire) {
this.onEndFireWeapon();
}
if (this.state === WormState.Firing) {
// Ignore all input when the worm is firing.
return;
}
if (inputKind === InputKind.MoveLeft || inputKind === InputKind.MoveRight) {
this.resetMoveDirection(inputKind);
}
Expand Down Expand Up @@ -439,6 +443,7 @@ export class Worm extends PlayableEntity {
this.state = WormState.InMotion;
} else if (this.state === WormState.MovingLeft || this.state === WormState.MovingRight) {
this.onMove(this.state);
// TODO: Allow moving aim while firing.
} else if (this.state === WormState.AimingUp || this.state === WormState.AimingDown) {
this.updateAiming();
}
Expand Down

0 comments on commit 7e38bd2

Please sign in to comment.