Skip to content

Commit 5a08c55

Browse files
committed
Add player rotation during double jump, make trails match rotation
1 parent 5d70c47 commit 5a08c55

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

public/scripts.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,20 @@ var animate = function () {
101101
jump_distance = 0.1;
102102
acceleration_step = acceleration;
103103
doublejumping = true;
104+
player.rotation.z -= 0.05; // poke
104105
}
105106

106107
jumping = true;
107108
}
108109

110+
if (player.rotation.z < 0) {
111+
player.rotation.z -= 0.05;
112+
113+
if (player.rotation.z < -3) {
114+
player.rotation.z = 0;
115+
}
116+
}
117+
109118
if (jumping || doublejumping) {
110119
acceleration_step = acceleration_step * (1 + acceleration);
111120

@@ -152,6 +161,9 @@ var animate = function () {
152161
trail.position.x = player.position.x;
153162
trail.position.z = player.position.z;
154163
trail.position.y = player.position.y;
164+
trail.rotation.x = player.rotation.x;
165+
trail.rotation.z = player.rotation.z;
166+
trail.rotation.y = player.rotation.y;
155167

156168
trails.push(trail);
157169

0 commit comments

Comments
 (0)