Skip to content

Commit

Permalink
Snap the obstacle back to its original position when its past the player
Browse files Browse the repository at this point in the history
  • Loading branch information
MattyRad committed Feb 8, 2020
1 parent 8167ca6 commit bc391e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ var animate = function () {

obstacle.position.x -= 0.01;

if (obstacle.position.x < (initial_x - 1)) {
obstacle.position.x = 1;
}

renderer.render(scene, camera);
};

Expand Down

0 comments on commit bc391e1

Please sign in to comment.