Fixed small issues

This commit is contained in:
Renan LE CARO 2025-02-17 10:21:54 +01:00
parent ed535cf470
commit f74f595a4d
4 changed files with 14 additions and 24 deletions

View file

@ -13,8 +13,8 @@ At the end of each level, you get to select an upgrade.
## TODO ## TODO
- apply a minimum speed to the ball (when 2 slower balls picked it is crawling)
- Fdroid - Fdroid
- perk : elastic between balls
- easily start a test game with specific upgrades or levels (with query string or through menu) - 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 total score on end screen (score added to total)
- show stats on end screen compared to other runs - show stats on end screen compared to other runs

View file

@ -1,7 +1,3 @@
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.time.ZoneId
plugins { plugins {
alias(libs.plugins.androidApplication) alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid) alias(libs.plugins.jetbrainsKotlinAndroid)

View file

@ -9,8 +9,9 @@ const puckHeight = ballSize;
if (allLevels.find(l => l.focus)) { if (allLevels.find(l => l.focus)) {
allLevels = allLevels.filter(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 = [] let runLevels = []
@ -576,14 +577,14 @@ const upgrades = [
"id": "ball_repulse_ball", "id": "ball_repulse_ball",
"name": "Balls repulse balls", "name": "Balls repulse balls",
"max": 3, "max": 3,
"help": "Only has an effect when 2+ balls." "help": "Only has an effect with 2+ balls."
}, },
{ {
"threshold": 98000, "threshold": 98000,
"id": "ball_attract_ball", "id": "ball_attract_ball",
"name": "Balls attract balls", "name": "Balls attract balls",
"max": 3, "max": 3,
"help": "Only has an effect when 2+ balls." "help": "Only has an effect with 2+ balls."
}, },
{ {
"threshold": 120000, "threshold": 120000,
@ -602,15 +603,12 @@ function getPossibleUpgrades() {
.filter(u => ts>=u.threshold) .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) { function shuffleLevels(nameToAvoid = null) {
const ts = getTotalScore(); const ts = getTotalScore();
runLevels = allLevels runLevels = allLevels
.filter(l => nextRunOverrides.level ? l.name === nextRunOverrides.level : true) .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) .filter(l => l.name !== nameToAvoid || allLevels.length === 1)
.sort(() => Math.random() - 0.5) .sort(() => Math.random() - 0.5)
.slice(0, 7 + 3) .slice(0, 7 + 3)
@ -636,10 +634,8 @@ function getUpgraderUnlockPoints() {
allLevels.forEach((l, li) => { allLevels.forEach((l, li) => {
list.push({ list.push({
threshold: levelTotalScoreCondition(l, li), threshold: l.threshold,
title: l.name + ' (Level)', 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) => { ...allLevels
const threshold = levelTotalScoreCondition(l, li) .sort((a, b) => a.threshold - b.threshold)
const avaliable = ts >= threshold .map((l, li) => {
const avaliable = ts >= l.threshold
return ({ return ({
text: l.name, 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, disabled: !avaliable,
value: {level: l.name} value: {level: l.name}

View file

@ -84,10 +84,7 @@ function addLevelEditorToList(level, levelIndex) {
<input type="checkbox" data-field="black_puck" ${level.black_puck ? 'checked':''} data-level="${levelIndex}" /> <input type="checkbox" data-field="black_puck" ${level.black_puck ? 'checked':''} data-level="${levelIndex}" />
black_puck black_puck
</label> </label>
<label>
<input type="checkbox" data-field="draft" ${level.draft ? 'checked':''} data-level="${levelIndex}" />
draft
</label>
</div> </div>
<div class="level-bricks-preview" id="bricks-of-${levelIndex}" > <div class="level-bricks-preview" id="bricks-of-${levelIndex}" >