Skip to content
Permalink
Browse files

Add player rotation during double jump, make trails match rotation

  • Loading branch information
MattyRad committed Feb 13, 2020
1 parent 5d70c47 commit 5a08c552666007039e40fc5a0118ac3783f6a442
Showing with 12 additions and 0 deletions.
  1. +12 −0 public/scripts.js
@@ -101,11 +101,20 @@ var animate = function () {
jump_distance = 0.1;
acceleration_step = acceleration;
doublejumping = true;
player.rotation.z -= 0.05; // poke
}

jumping = true;
}

if (player.rotation.z < 0) {
player.rotation.z -= 0.05;

if (player.rotation.z < -3) {
player.rotation.z = 0;
}
}

if (jumping || doublejumping) {
acceleration_step = acceleration_step * (1 + acceleration);

@@ -152,6 +161,9 @@ var animate = function () {
trail.position.x = player.position.x;
trail.position.z = player.position.z;
trail.position.y = player.position.y;
trail.rotation.x = player.rotation.x;
trail.rotation.z = player.rotation.z;
trail.rotation.y = player.rotation.y;

trails.push(trail);

0 comments on commit 5a08c55

Please sign in to comment.
You can’t perform that action at this time.