Up-in-the-Air – commitdiff

You can use Git to clone the repository via the web URL. Download snapshot (zip)
Be more explicit about when to reposition the camera in non-gameplay scenes
authorJulian Fietkau <git@fietkau.software>
Mon, 30 Sep 2024 16:52:31 +0000 (18:52 +0200)
committerJulian Fietkau <git@fietkau.software>
Mon, 30 Sep 2024 16:52:31 +0000 (18:52 +0200)
main.js

diff --git a/main.js b/main.js
index 8f8dd85f5401497a2d188a0b4073700b0e603cec..b89a52ff0170e48c42947afe53fa24e83019db7c 100644 (file)
--- a/main.js
+++ b/main.js
@@ -748,9 +748,10 @@ game['fn'].animate = ( scene) => {
     if(game.settings['graphics'] == 3) {
       cameraSwayFactor = 0;
     }
-    let cameraX = -5;
-    let cameraY = 0;
+    let cameraX, cameraY;
     if(game.ui.currentPage == 'title') {
+      cameraX = -5;
+      cameraY = 0;
       if(!game.ui.reachedEnd) {
         game.objects.feather.position.set(cameraX - 8.45, -game.courseRadius - 6.4, -9.9);
         game.objects.feather.rotation.set(Math.PI, 0, Math.PI / 2.1);
@@ -797,6 +798,8 @@ game['fn'].animate = ( scene) => {
         }
       }
     } else if(game.ui.currentPage == 'openingcutscene') {
+      cameraX = -5;
+      cameraY = 0;
       if(game.ui.reachedEnd) {
         game['fn'].reset();
       }
@@ -870,6 +873,8 @@ game['fn'].animate = ( scene) => {
         game['fn'].moveToPage('gameplay', true);
       }
     } else if(game.ui.currentPage == 'endingcutscene') {
+      cameraX = -5;
+      cameraY = 0;
       cameraSwayFactor = cameraSwayFactor * game.timeProgress / 8;
       cameraX = 5 - Math.pow(Math.max(0, 5 - game.timeProgress) / 5, 1.6) * 5;
       let trajectoryLerpValue = game['fn'].easeInOut(Math.min(6.0, game.timeProgress) / 6);
@@ -920,9 +925,12 @@ game['fn'].animate = ( scene) => {
       }
     } else if(game.ui.reachedEnd) {
       cameraX = 5;
+      cameraY = 0;
+    }
+    if(typeof(cameraX) == 'number' && typeof(cameraY) == 'number') {
+      game.view.camera.position.setY(cameraY - game.courseRadius + 0.07 * cameraSwayFactor * Math.sin(game.view.clock.getElapsedTime() * 0.5));
+      game.view.camera.position.setX(cameraX + 0.05 * cameraSwayFactor * Math.sin(game.view.clock.getElapsedTime() * 0.7));
     }
-    game.view.camera.position.setY(cameraY - game.courseRadius + 0.07 * cameraSwayFactor * Math.sin(game.view.clock.getElapsedTime() * 0.5));
-    game.view.camera.position.setX(cameraX + 0.05 * cameraSwayFactor * Math.sin(game.view.clock.getElapsedTime() * 0.7));
     game.view.renderer.render(scene, game.view.camera);
     return;
   }
@@ -2220,23 +2228,23 @@ game['fn'].start = () => {
 };
 
 // Set up name mirrors for each function that should survive most minifiers and transpilers
-game['fn']['animate'] = game['fn'].animate;
-game['fn']['applyForceToFeather'] = game['fn'].applyForceToFeather;
-game['fn']['applySettings'] = game['fn'].applySettings;
-game['fn']['createFeather'] = game['fn'].createFeather;
-game['fn']['createMeshes'] = game['fn'].createMeshes;
-game['fn']['easeInOut'] = game['fn'].easeInOut;
-game['fn']['initializeGame'] = game['fn'].initializeGame;
-game['fn']['lerp'] = game['fn'].lerp;
-game['fn']['loadAllAssets'] = game['fn'].loadAllAssets;
-game['fn']['loadSettings'] = game['fn'].loadSettings;
-game['fn']['moveToPage'] = game['fn'].moveToPage;
-game['fn']['playRandomSound'] = game['fn'].playRandomSound;
-game['fn']['prepareWordMesh'] = game['fn'].prepareWordMesh;
-game['fn']['reset'] = game['fn'].reset;
-game['fn']['start'] = game['fn'].start;
-game['fn']['unlockFeather'] = game['fn'].unlockFeather;
-game['fn']['unlockWithKey'] = game['fn'].unlockWithKey;
+game['fn'].animate['friendlyName'] = 'animate';
+game['fn'].applyForceToFeather['friendlyName'] = 'applyForceToFeather';
+game['fn'].applySettings['friendlyName'] = 'applySettings';
+game['fn'].createFeather['friendlyName'] = 'createFeather';
+game['fn'].createMeshes['friendlyName'] = 'createMeshes';
+game['fn'].easeInOut['friendlyName'] = 'easeInOut';
+game['fn'].initializeGame['friendlyName'] = 'initializeGame';
+game['fn'].lerp['friendlyName'] = 'lerp';
+game['fn'].loadAllAssets['friendlyName'] = 'loadAllAssets';
+game['fn'].loadSettings['friendlyName'] = 'loadSettings';
+game['fn'].moveToPage['friendlyName'] = 'moveToPage';
+game['fn'].playRandomSound['friendlyName'] = 'playRandomSound';
+game['fn'].prepareWordMesh['friendlyName'] = 'prepareWordMesh';
+game['fn'].reset['friendlyName'] = 'reset';
+game['fn'].start['friendlyName'] = 'start';
+game['fn'].unlockFeather['friendlyName'] = 'unlockFeather';
+game['fn'].unlockWithKey['friendlyName'] = 'unlockWithKey';
 
 game['fn'].start();