When trying a perk or level, actually play the run

This commit is contained in:
Renan LE CARO 2025-03-05 19:50:17 +01:00
parent b3bbeb59b7
commit 08f2566faa
3 changed files with 42 additions and 60 deletions

View file

@ -1,3 +1,6 @@
# bugs
- having Hot Start and Single puck hit streak perks in a run resets combo from start [29014379]
# Game engine features # Game engine features
- the onboarding feels weird, missing a tutorial - the onboarding feels weird, missing a tutorial
@ -42,6 +45,7 @@
# Perks ideas # Perks ideas
- second puck (symmeric to the first one)
- keep combo between level, loose half your run score when missing any bricks - keep combo between level, loose half your run score when missing any bricks
- offer next level choice after upgrade pick - offer next level choice after upgrade pick
- ban 3 random perks from pool, doesn't tell you which ones, gain 2 upgrades - ban 3 random perks from pool, doesn't tell you which ones, gain 2 upgrades

View file

@ -245,7 +245,7 @@ function addToScore(coin) {
coin.destroyed = true coin.destroyed = true
score += coin.points; score += coin.points;
addToTotalScore(coin.points) addToTotalScore(coin.points)
if (score > highScore && !hadOverrides) { if (score > highScore ) {
highScore = score; highScore = score;
localStorage.setItem("breakout-3-hs", score); localStorage.setItem("breakout-3-hs", score);
} }
@ -516,9 +516,7 @@ const upgrades = [{
"name": "Viscosity", "name": "Viscosity",
"max": 3, "max": 3,
help: lvl => `${lvl > 1 ? 'Even slower' : 'Slower'} coins fall.`, help: lvl => `${lvl > 1 ? 'Even slower' : 'Slower'} coins fall.`,
tryout: {
perks: {viscosity: 3, base_combo: 3}, level: 'Waves'
},
fullHelp: `Coins normally accelerate with gravity and explosions to pretty high speeds. This perk constantly makes them slow down, as if they were in some sort of viscous liquid. fullHelp: `Coins normally accelerate with gravity and explosions to pretty high speeds. This perk constantly makes them slow down, as if they were in some sort of viscous liquid.
This makes catching them easier, and combines nicely with perks that influence the coin's movement. ` This makes catching them easier, and combines nicely with perks that influence the coin's movement. `
}, { }, {
@ -569,9 +567,7 @@ const upgrades = [{
"name": "Coins magnet", "name": "Coins magnet",
"max": 3, "max": 3,
help: lvl => lvl == 1 ? `Puck attracts coins.` : `Stronger effect on the coins`, help: lvl => lvl == 1 ? `Puck attracts coins.` : `Stronger effect on the coins`,
tryout: {
perks: {coin_magnet: 3, base_combo: 3}
},
fullHelp: `Directs the coins to the puck. The effect is stronger if the coin is close to it already. Catching 90% or 100% of coins bring special bonuses in the game. fullHelp: `Directs the coins to the puck. The effect is stronger if the coin is close to it already. Catching 90% or 100% of coins bring special bonuses in the game.
Another way to catch more coins is to hit bricks from the bottom. The ball's speed and direction impacts the spawned coin's velocity. ` Another way to catch more coins is to hit bricks from the bottom. The ball's speed and direction impacts the spawned coin's velocity. `
}, { }, {
@ -608,9 +604,7 @@ const upgrades = [{
"name": "Picky eater", "name": "Picky eater",
"max": 1, "max": 1,
help: lvl => `More coins if you break bricks color by color.`, help: lvl => `More coins if you break bricks color by color.`,
tryout: {
perks: {picky_eater: 1}, level: 'Mountain'
},
fullHelp: `Whenever you break a brick the same color as your ball, your combo increases by one. fullHelp: `Whenever you break a brick the same color as your ball, your combo increases by one.
If it's a different color, the ball takes that new color, but the combo resets. If it's a different color, the ball takes that new color, but the combo resets.
The bricks with the right color will get a white border. The bricks with the right color will get a white border.
@ -624,9 +618,6 @@ const upgrades = [{
"name": "Stain", "name": "Stain",
"max": 1, "max": 1,
help: lvl => `Coins color the bricks they touch.`, help: lvl => `Coins color the bricks they touch.`,
tryout: {
perks: {metamorphosis: 3}, level: 'Lines'
},
fullHelp: `With this perk, coins will be of the color of the brick they come from, and will color the first brick they touch in the same color. Coins spawn with the speed fullHelp: `With this perk, coins will be of the color of the brick they come from, and will color the first brick they touch in the same color. Coins spawn with the speed
of the ball that broke them, which means you can aim a bit in the direction of the bricks you want to "paint". of the ball that broke them, which means you can aim a bit in the direction of the bricks you want to "paint".
@ -672,9 +663,7 @@ const upgrades = [{
"max": 1, "max": 1,
help: lvl => 'Bigger explosions', help: lvl => 'Bigger explosions',
tryout: {
perks: {bigger_explosions: 1}, level: 'Ship'
},
fullHelp: `The default explosion clears a 3x3 square, with this it becomes a 5x5 square, and the blowback on the coins is also significantly stronger. ` fullHelp: `The default explosion clears a 3x3 square, with this it becomes a 5x5 square, and the blowback on the coins is also significantly stronger. `
}, { }, {
"threshold": 13000, "threshold": 13000,
@ -707,9 +696,6 @@ const upgrades = [{
"max": 3, "max": 3,
help: lvl => lvl === 1 ? `Balls repulse balls.` : 'Stronger repulsion force', help: lvl => lvl === 1 ? `Balls repulse balls.` : 'Stronger repulsion force',
tryout: {
perks: {ball_repulse_ball: 1, multiball: 2},
},
fullHelp: `Balls that are less than half a screen width away will start repulsing each other. The repulsion force is stronger if they are close to each other. fullHelp: `Balls that are less than half a screen width away will start repulsing each other. The repulsion force is stronger if they are close to each other.
Particles will jet out to symbolize this force being applied. This perk is only offered if you have more than one ball already.` Particles will jet out to symbolize this force being applied. This perk is only offered if you have more than one ball already.`
}, { }, {
@ -719,9 +705,7 @@ const upgrades = [{
"name": "Gravity", "name": "Gravity",
"max": 3, "max": 3,
help: lvl => lvl === 1 ? `Balls attract balls.` : 'Stronger attraction force', help: lvl => lvl === 1 ? `Balls attract balls.` : 'Stronger attraction force',
tryout: {
perks: {ball_attract_ball: 1, multiball: 2},
},
fullHelp: `Balls that are more than half a screen width away will start attracting each other. The attraction force is stronger when they are furthest away from each other. fullHelp: `Balls that are more than half a screen width away will start attracting each other. The attraction force is stronger when they are furthest away from each other.
Rainbow particles will fly to symbolize the attraction force. This perk is only offered if you have more than one ball already.` Rainbow particles will fly to symbolize the attraction force. This perk is only offered if you have more than one ball already.`
}, { }, {
@ -789,18 +773,19 @@ function getPossibleUpgrades() {
function shuffleLevels(nameToAvoid = null) { function shuffleLevels(nameToAvoid = null) {
const target = nextRunOverrides?.level; const target = nextRunOverrides?.level;
if (target) { const firstLevel = nextRunOverrides?.level ?
runLevels = allLevels.filter(l => l.name === target) allLevels.filter(l => l.name === target) : []
nextRunOverrides.level = null
if (runLevels.length) return
}
runLevels = allLevels const restInRandomOrder= allLevels
.filter((l, li) => totalScoreAtRunStart >= l.threshold) .filter((l, li) => totalScoreAtRunStart >= l.threshold)
.filter(l=>l.name!==nextRunOverrides?.level)
.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)
.sort((a, b) => a.sortKey - b.sortKey); runLevels = firstLevel.concat(
restInRandomOrder.slice(0, 7 + 3)
.sort((a, b) => a.sortKey - b.sortKey)
)
} }
@ -857,10 +842,9 @@ function pickRandomUpgrades(count) {
} }
let nextRunOverrides = {level: null, perks: null} let nextRunOverrides = {level: null, perks: null}
let hadOverrides = false, pauseUsesDuringRun = 0 let pauseUsesDuringRun = 0
function restart() { function restart() {
hadOverrides = !!(nextRunOverrides.level || nextRunOverrides.perks)
// When restarting, we want to avoid restarting with the same level we're on, so we exclude from the next // When restarting, we want to avoid restarting with the same level we're on, so we exclude from the next
// run's level list // run's level list
totalScoreAtRunStart = getTotalScore() totalScoreAtRunStart = getTotalScore()
@ -1462,7 +1446,6 @@ function getTotalScore() {
} }
function addToTotalScore(points) { function addToTotalScore(points) {
if (hadOverrides) return
try { try {
localStorage.setItem('breakout_71_total_score', JSON.stringify(getTotalScore() + points)) localStorage.setItem('breakout_71_total_score', JSON.stringify(getTotalScore() + points))
} catch (e) { } catch (e) {
@ -1544,10 +1527,6 @@ function gameOver(title, intro) {
function getHistograms(saveStats) { function getHistograms(saveStats) {
if (hadOverrides) {
return ''
}
let runStats = '' let runStats = ''
try { try {
// Stores only top 100 runs // Stores only top 100 runs
@ -1723,15 +1702,18 @@ function explodeBrick(index, ball, isExplosion) {
} }
console.log('Spawned a coin with ' + points + ' points') console.log('Spawned a coin with ' + points + ' points')
coinsToSpawn -= points coinsToSpawn -= points
const coord = {
x: x + (Math.random() - 0.5) * (brickWidth - coinSize), const cx= x + (Math.random() - 0.5) * (brickWidth - coinSize),
y: y + (Math.random() - 0.5) * (brickWidth - coinSize), cy=y + (Math.random() - 0.5) * (brickWidth - coinSize);
};
coins.push({ coins.push({
points, points,
color: perks.metamorphosis ? color : 'gold', ...coord, color: perks.metamorphosis ? color : 'gold',
previousx: coord.x, x:cx,
previousy: coord.y, // Use previous speed because the ball has already bounced y:cy,
previousx: cx,
previousy: cy,
// Use previous speed because the ball has already bounced
vx: ball.previousvx * (0.5 + Math.random()), vx: ball.previousvx * (0.5 + Math.random()),
vy: ball.previousvy * (0.5 + Math.random()), vy: ball.previousvy * (0.5 + Math.random()),
sx: 0, sx: 0,
@ -1773,7 +1755,7 @@ function explodeBrick(index, ball, isExplosion) {
function max_levels() { function max_levels() {
if (hadOverrides) return 1
return 7 + perks.extra_levels; return 7 + perks.extra_levels;
} }
@ -2662,17 +2644,17 @@ async function openSettingsPanel() {
} }
}, { }, {
text: 'Unlocks and help', help: "See perks and levels you unlocked", async value() { text: 'Starting perk', help: "Try perks and levels you unlocked", async value() {
const ts = getTotalScore() const ts = getTotalScore()
const actions = [...upgrades const actions = [...upgrades
.sort((a, b) => a.threshold - b.threshold) .sort((a, b) => a.threshold - b.threshold)
.map(({ .map(({
name, max, help, id, threshold, icon, tryout, fullHelp name, help, id, threshold, icon, fullHelp
}) => ({ }) => ({
text: name, text: name,
help: ts >= threshold ? fullHelp || help : `Unlocks at total score ${threshold}.`, help: ts >= threshold ? fullHelp || help : `Unlocks at total score ${threshold}.`,
disabled: ts < threshold, disabled: ts < threshold,
value: tryout || {perks: {[id]: max}}, value: {perks: {[id]: 1}},
icon icon
})) }))
@ -2697,7 +2679,7 @@ async function openSettingsPanel() {
textAfterButtons: `<p> textAfterButtons: `<p>
The total score increases every time you score in game. The total score increases every time you score in game.
Your high score is ${highScore}. Your high score is ${highScore}.
Click an item above to start a test run with it. Click an item above to start a run with it.
</p>`, </p>`,
actions, actions,
allowClose: true, allowClose: true,
@ -2705,7 +2687,7 @@ Click an item above to start a test run with it.
if (tryOn) { if (tryOn) {
if (!currentLevel || await asyncAlert({ if (!currentLevel || await asyncAlert({
title: 'Restart run to try this item?', title: 'Restart run to try this item?',
text: 'You\'re about to start a new test run with just the selected unlocked item, is that really what you wanted ? ', text: 'You\'re about to start a new run with the selected unlocked item, is that really what you wanted ? ',
actions: [{ actions: [{
value: true, text: 'Restart game to test item' value: true, text: 'Restart game to test item'
}, { }, {

View file

@ -2,37 +2,33 @@
set -e set -e
set -x set -x
# Replace the version code and name in gradle for fdroid and play store # the version number is just a unix timestamp in minutes
versionCode=$(($(date +%s) / 60)) versionCode=$(($(date +%s) / 60))
# On macOS you should use -i '' not just -i, but i'm on linux # Replace the version code and name in gradle for fdroid and play store
sed -i -e "s/^[[:space:]]*versionCode = .*/ versionCode = $versionCode/" \ sed -i -e "s/^[[:space:]]*versionCode = .*/ versionCode = $versionCode/" \
-e "s/^[[:space:]]*versionName = .*/ versionName = \"$versionCode\"/" \ -e "s/^[[:space:]]*versionName = .*/ versionName = \"$versionCode\"/" \
./app/build.gradle.kts ./app/build.gradle.kts
# Invalidate web cache and update version # Invalidate web cache and update version
sed -i "s/\?v=[0-9]*/\?v=$versionCode/g" ./app/src/main/assets/index.html sed -i "s/\?v=[0-9]*/\?v=$versionCode/g" ./app/src/main/assets/index.html
# remove all exif metadata from pictures, because i think fdroid doesn't like that. odd # remove all exif metadata from pictures, because i think fdroid doesn't like that. odd
find -name '*.jp*g' -o -name '*.png' | xargs exiftool -all= find -name '*.jp*g' -o -name '*.png' | xargs exiftool -all=
# Create a release commit and tag
git add . git add .
git commit -m "Automatic deploy $versionCode" git commit -m "Automatic deploy $versionCode"
git tag -a $versionCode -m $versionCode git tag -a $versionCode -m $versionCode
git push git push
# upload to breakout.lecaro.me
DOMAIN="breakout.lecaro.me" DOMAIN="breakout.lecaro.me"
PUBLIC_CONTENT="./app/src/main/assets/" PUBLIC_CONTENT="./app/src/main/assets/"
ssh staging "mkdir -p /opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN" ssh staging "mkdir -p /opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN"
rsync -avz --delete --delete-excluded --exclude="*.sh" --exclude="node_modules" --exclude="android" --exclude=".*" $PUBLIC_CONTENT staging:/opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN rsync -avz --delete --delete-excluded --exclude="*.sh" --exclude="node_modules" --exclude="android" --exclude=".*" $PUBLIC_CONTENT staging:/opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN
# upload to itch.io
# generate zip for itch
rm -f breakout.zip
zip -j breakout.zip app/src/main/assets/*
butler push app/src/main/assets/ renanlecaro/breakout71:latest --userversion $versionCode butler push app/src/main/assets/ renanlecaro/breakout71:latest --userversion $versionCode
butler push app/src/main/assets/ renanlecaro/breakout71:offline --userversion $versionCode butler push app/src/main/assets/ renanlecaro/breakout71:offline --userversion $versionCode