From 96340d0984ee2821c1a01db6a513cff29dfade7a Mon Sep 17 00:00:00 2001 From: Mottributo <87079566+Mottributo@users.noreply.github.com> Date: Thu, 23 Mar 2023 17:49:32 +0300 Subject: [PATCH] finish oriented edits; no gen after finish, no camera movement after finish --- sketch.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sketch.js b/sketch.js index 0bfc512..9112f2a 100644 --- a/sketch.js +++ b/sketch.js @@ -156,12 +156,14 @@ function startGame(full_start, update_objects) { width: 50, points: [], }; - } else + } else { + if (canyons[i - 1].x + 600 > finish_position_x) break; canyons[i] = { x: canyons[i - 1].x + 300 + 200 * random(0.5, 1), width: 50 + 30 * random(), points: [], }; + } } for (i = 0; i < 100; i++) { if (i == 0) { @@ -171,15 +173,19 @@ function startGame(full_start, update_objects) { size: 75, isFound: false, }; - } else + } else { + if (collectables[i - 1].x + 200 > finish_position_x) { + break; + } collectables[i] = { - x: collectables[i - 1].x + 50 + 150 * random(0.5, 1), + x: collectables[i - 1].x + 50 + 100 * random(0.5, 1), y: gameChar.possibleGroundPosY[ - ceil(random(0, gameChar.possibleGroundPosY.length)) + floor(random(0, gameChar.possibleGroundPosY.length)) ], size: 75, isFound: false, }; + } } } flagpole = { @@ -205,7 +211,7 @@ function draw() { fill(0); translate(-cameraPosX, 0); // Scrolling - cameraPosX = gameChar.x - width / 2; // Scrolling + if (gameChar.x < finish_position_x) cameraPosX = gameChar.x - width / 2; // Scrolling // -------- CLOUDS -------------- drawClouds(); @@ -512,7 +518,7 @@ function drawGround() { ); stroke(1); translate(-cameraPosX, 0); - for (i = 0; i < finish_position_x; i += 20) { + for (i = -width/2; i < finish_position_x + width/2; i += 20) { line( i, floorPos_y + (2 * (height - floorPos_y)) / 6,