Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Commit

Permalink
Adjust chopper animation (#15)
Browse files Browse the repository at this point in the history
This causes the chopper to tilt less backwards, and also changes the animation speed based on the velocity (i.e. rotor blades will go slower/faster).
  • Loading branch information
peol committed Nov 8, 2018
1 parent 43a6446 commit 2e4dc96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/game/chopper.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export default ex.Actor.extend({
if (this.vel.y > 0) {
this.setDrawing('down');
}
this.upAnimation.speed = 300 - Math.abs(this.vel.y);
this.downAnimation.speed = 300 + Math.abs(this.vel.y);
},

bounce(power) {
Expand All @@ -90,6 +92,7 @@ export default ex.Actor.extend({
return;
}
const adjustedSpeed = -power * 2;
this.lastPower = power;
this.upAnimation.reset();
this.setDrawing('up');
this.unclampedVelocity = this.vel.y + (adjustedSpeed - this.powerModifier);
Expand Down
2 changes: 1 addition & 1 deletion src/game/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
ACCELERATION: 250,
MAX_VELOCITY: 350,
MAX_DOWNWARDS_VELOCITY: 2000,
LEVEL_SPEED: -200,
LEVEL_SPEED: -1200,
scale: DEFAULT_SCALE,
labelBase: {
baseAlign: ex.BaseAlign.Top,
Expand Down

0 comments on commit 2e4dc96

Please sign in to comment.