From 3ca4681a749f56fd4d0dc290a154d6897af88c1b Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 27 Aug 2018 14:41:29 +0200 Subject: [PATCH] Increase camera speed when time goes by --- src/scene.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/scene.js b/src/scene.js index 569d49b..50523fb 100644 --- a/src/scene.js +++ b/src/scene.js @@ -20,6 +20,10 @@ class Scene extends Screen { }); } + updateCameraSpeed(height) { + this.cameraSpeed = 0.0005 + (height / 200) * 0.0001; + } + get maxHeight() { return window.localStorage.getItem("maxHeight"); } @@ -194,6 +198,10 @@ class Scene extends Screen { // Update coin frames this.collectables.map((c) => c.update(time)); + + if (this.started) { + this.updateCameraSpeed(heightToScore(this.currentHeight)); + } } addPlatform(object) {