Skip to content

Commit bc391e1

Browse files
committed
Snap the obstacle back to its original position when its past the player
1 parent 8167ca6 commit bc391e1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

public/scripts.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ var animate = function () {
2828

2929
obstacle.position.x -= 0.01;
3030

31+
if (obstacle.position.x < (initial_x - 1)) {
32+
obstacle.position.x = 1;
33+
}
34+
3135
renderer.render(scene, camera);
3236
};
3337

0 commit comments

Comments
 (0)