moved obstacle Reset Cheking into a function

This commit is contained in:
dhain 2022-12-13 10:04:16 +01:00
parent d0724e668a
commit 4219704649

View file

@ -48,12 +48,16 @@ function draw() {
obstacle.draw();
obstacle.update();
if(obstacle.position.x < -obstacleWidth) {
obstacle.resetPosition(true);
}
checkObstacleReset(obstacle);
});
}
function checkObstacleReset(obstacle: Obstacle){
if(obstacle.position.x < -obstacleWidth) {
obstacle.resetPosition(true);
}
}
//
// function keyPressed() {
//