From f74f595a4d83fc0f25b9a73f56ca86c47fe3a2f7 Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Mon, 17 Feb 2025 10:21:54 +0100 Subject: [PATCH] Fixed small issues --- Readme.md | 2 +- app/build.gradle.kts | 4 ---- app/src/main/assets/game.js | 27 ++++++++++++--------------- editclient.js | 5 +---- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/Readme.md b/Readme.md index 488de26..79bdc08 100644 --- a/Readme.md +++ b/Readme.md @@ -13,8 +13,8 @@ At the end of each level, you get to select an upgrade. ## TODO +- apply a minimum speed to the ball (when 2 slower balls picked it is crawling) - Fdroid -- perk : elastic between balls - easily start a test game with specific upgrades or levels (with query string or through menu) - show total score on end screen (score added to total) - show stats on end screen compared to other runs diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 53707ef..9fd88d9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,7 +1,3 @@ -import java.time.ZonedDateTime -import java.time.format.DateTimeFormatter -import java.time.ZoneId - plugins { alias(libs.plugins.androidApplication) alias(libs.plugins.jetbrainsKotlinAndroid) diff --git a/app/src/main/assets/game.js b/app/src/main/assets/game.js index b9ece0d..cf04a1c 100644 --- a/app/src/main/assets/game.js +++ b/app/src/main/assets/game.js @@ -9,8 +9,9 @@ const puckHeight = ballSize; if (allLevels.find(l => l.focus)) { allLevels = allLevels.filter(l => l.focus) } -allLevels = allLevels.filter(l => !l.draft) - +allLevels.forEach((l,li)=>{ + l.threshold= li < 8 ? 0 : Math.round(Math.pow(10, 1 + (li + l.size) / 30) * (li)) * 10 +}) let runLevels = [] @@ -576,14 +577,14 @@ const upgrades = [ "id": "ball_repulse_ball", "name": "Balls repulse balls", "max": 3, - "help": "Only has an effect when 2+ balls." + "help": "Only has an effect with 2+ balls." }, { "threshold": 98000, "id": "ball_attract_ball", "name": "Balls attract balls", "max": 3, - "help": "Only has an effect when 2+ balls." + "help": "Only has an effect with 2+ balls." }, { "threshold": 120000, @@ -602,15 +603,12 @@ function getPossibleUpgrades() { .filter(u => ts>=u.threshold) } -function levelTotalScoreCondition(l, li) { - return li < 8 ? 0 : Math.round(Math.pow(10, 1 + (li + l.size) / 30) * (li)) * 10 -} function shuffleLevels(nameToAvoid = null) { const ts = getTotalScore(); runLevels = allLevels .filter(l => nextRunOverrides.level ? l.name === nextRunOverrides.level : true) - .filter((l, li) => ts >= levelTotalScoreCondition(l, li)) + .filter((l, li) => ts >= l.threshold) .filter(l => l.name !== nameToAvoid || allLevels.length === 1) .sort(() => Math.random() - 0.5) .slice(0, 7 + 3) @@ -636,10 +634,8 @@ function getUpgraderUnlockPoints() { allLevels.forEach((l, li) => { list.push({ - threshold: levelTotalScoreCondition(l, li), + threshold: l.threshold, title: l.name + ' (Level)', - // help: 'Adds level "'+l.name + '" to the list of possible levels.', - }) }) @@ -2229,12 +2225,13 @@ async function openSettingsPanel() { ) , - ...allLevels.map((l, li) => { - const threshold = levelTotalScoreCondition(l, li) - const avaliable = ts >= threshold + ...allLevels + .sort((a, b) => a.threshold - b.threshold) + .map((l, li) => { + const avaliable = ts >= l.threshold return ({ text: l.name, - help: `A ${l.size}x${l.size} level` + (avaliable ? '' : `(${threshold} coins)`), + help: `A ${l.size}x${l.size} level` + (avaliable ? '' : `(${l.threshold} coins)`), disabled: !avaliable, value: {level: l.name} diff --git a/editclient.js b/editclient.js index f6d961c..d5a9320 100644 --- a/editclient.js +++ b/editclient.js @@ -84,10 +84,7 @@ function addLevelEditorToList(level, levelIndex) { black_puck - +