This commit is contained in:
Renan LE CARO 2025-03-19 14:06:49 +01:00
parent 2623eaaa73
commit 708c9bda1c
11 changed files with 7593 additions and 34 deletions

View file

@ -23,8 +23,10 @@ There's also an easy mode for kids (slower ball).
# Next
- check which color you get if picking a color related perk
- sturdy bricks map of remaining hits
- different visual effects on ball to represent which perks it's imbued with (pierce, sapper…). remove visual while it's not affected (can't pierce/sap anymore until touching the puck).
- check which ball color you get right after picking a color related perk
- sturdy bricks: map of remaining hits
- looks like offline PWA mode does not work
# bugs
@ -67,11 +69,10 @@ There's also an easy mode for kids (slower ball).
# graphics
- apply global curve / brightness to canvas when things blow, or just always to make neon effect better
- lights shadows with background gradient light map ?
- webgl rendering
- shinier coins by applying glow to them
- different visual effects on ball to represent which perks it's imbued with (pierce, sapper…). remove visual while it's not affected (can't pierce/sap anymore until touching the puck).
- experiment with showing the combo somewhere else, maybe top center, maybe instead of score.
- the white outline on bricks associated with picky eater kinda works but i feel it's more distracting than anything. maybe try something different ? put a cross on matching coloured bricks, or the contrary, grey out other bricks.
@ -160,8 +161,7 @@ There's also an easy mode for kids (slower ball).
- [colin] perk: roulette - gagne instantanément 2 perks aléatoires
- let coins go out of bounds left and right, where they'll get lost, but +1 combo per brick
- more combo if no coin catch
- combo climbs every time a ball bounces on puck (but bounce is random?)
-
- combo climbs every time a ball bounces on puck (but bounce is random?)
# extra levels

View file

@ -11,8 +11,8 @@ android {
applicationId = "me.lecaro.breakout"
minSdk = 21
targetSdk = 34
versionCode = 29038489
versionName = "29038489"
versionCode = 29039826
versionName = "29039826"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true

File diff suppressed because one or more lines are too long

33
dist/PWA/sw-b71.js vendored
View file

@ -1,2 +1,33 @@
function e(e,t,n,r,a,i,c){try{var o=e[i](c),u=o.value}catch(e){n(e);return}o.done?t(u):Promise.resolve(u).then(r,a)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(a,i){var c=t.apply(n,r);function o(t){e(c,a,i,o,u,"next",t)}function u(t){e(c,a,i,o,u,"throw",t)}o(void 0)})}}function n(e,t){var n,r,a,i,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(i){return function(o){return function(i){if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(a=(a=c.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){c.label=i[1];break}if(6===i[0]&&c.label<a[1]){c.label=a[1],a=i;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(i);break}a[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,o])}}}var r="breakout-71-".concat("29038489"),a=["/"];self.addEventListener("install",function(e){e.waitUntil(t(function(){return n(this,function(e){switch(e.label){case 0:return[4,caches.open(r)];case 1:return e.sent().addAll(a),[2]}})})())}),self.addEventListener("activate",function(e){e.waitUntil(t(function(){return n(this,function(e){switch(e.label){case 0:return[4,caches.keys()];case 1:return[4,Promise.all(e.sent().map(function(e){if(e!==r)return caches.delete(e)}))];case 2:return e.sent(),[4,clients.claim()];case 3:return e.sent(),[2]}})})())}),self.addEventListener("fetch",function(e){if("navigate"===e.request.mode&&e.request.url.endsWith("/index.html?isPWA=true")){e.respondWith(caches.match("/"));return}});
// The version of the cache.
const VERSION = "29039826";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;
// The static resources that the app needs to function.
const APP_STATIC_RESOURCES = [
"/"
];
// On install, cache the static resources
self.addEventListener("install", (event)=>{
event.waitUntil((async ()=>{
const cache = await caches.open(CACHE_NAME);
cache.addAll(APP_STATIC_RESOURCES);
})());
});
// delete old caches on activate
self.addEventListener("activate", (event)=>{
event.waitUntil((async ()=>{
const names = await caches.keys();
await Promise.all(names.map((name)=>{
if (name !== CACHE_NAME) return caches.delete(name);
}));
await clients.claim();
})());
});
self.addEventListener("fetch", (event)=>{
if (event.request.mode === "navigate" && event.request.url.endsWith("/index.html?isPWA=true")) {
event.respondWith(caches.match("/"));
return;
}
});
//# sourceMappingURL=sw-b71.js.map

File diff suppressed because one or more lines are too long

3761
dist/index.html vendored

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
// The version of the cache.
const VERSION = "29038489";
const VERSION = "29039826";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;

View file

@ -1 +1 @@
"29038489"
"29039826"

View file

@ -273,8 +273,6 @@ export async function openUpgradesPicker(gameState: GameState) {
gameState.runStatistics.upgrades_picked++;
}
resetCombo(gameState, undefined, undefined);
resetBalls(gameState);
}
gameCanvas.addEventListener("mouseup", (e) => {

View file

@ -82,7 +82,6 @@ export function resetBalls(gameState: GameState) {
sx: 0,
sy: 0,
sparks: 0,
piercedSinceBounce: 0,
hitSinceBounce: 0,
hitItem: [],
@ -166,9 +165,7 @@ export function resetCombo(
) {
const prev = gameState.combo;
gameState.combo = baseCombo(gameState);
if (!gameState.levelTime) {
gameState.combo += gameState.perks.hot_start * 15;
}
if (prev > gameState.combo && gameState.perks.soft_reset) {
gameState.combo += Math.floor(
((prev - gameState.combo) * (gameState.perks.soft_reset * 10)) / 100,
@ -467,14 +464,13 @@ export function addToScore(gameState: GameState, coin: Coin) {
gameState.runStatistics.score += coin.points;
}
export function setLevel(gameState: GameState, l: number) {
export async function setLevel(gameState: GameState, l: number) {
stopRecording();
pause(false);
if (l > 0) {
openUpgradesPicker(gameState);
await openUpgradesPicker(gameState);
}
gameState.currentLevel = l;
gameState.levelTime = 0;
gameState.levelWallBounces = 0;
gameState.autoCleanUses = 0;
@ -484,7 +480,9 @@ export function setLevel(gameState: GameState, l: number) {
gameState.levelMisses = 0;
gameState.runStatistics.levelsPlayed++;
resetCombo(gameState, undefined, undefined);
// Reset combo silently
gameState.combo = baseCombo(gameState) + gameState.perks.hot_start * 15;
resetBalls(gameState);
const lvl = currentLevelInfo(gameState);
@ -1161,21 +1159,36 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
}
if (!isOptionOn("basic")) {
ball.sparks += (delta * (gameState.combo - 1)) / 30;
if (ball.sparks > 1) {
const remainingPierce =
gameState.perks.pierce * 3 - ball.piercedSinceBounce;
const remainingSapper = ball.sapperUses < gameState.perks.sapper;
const extraCombo = gameState.combo - 1;
if (
(extraCombo && Math.random() > 0.1 / (1 + extraCombo)) ||
(remainingSapper && Math.random() > 0.1 / (1 + remainingSapper)) ||
(extraCombo && Math.random() > 0.1 / (1 + extraCombo))
) {
const color = remainingSapper
? Math.random() > 0.5
? "orange"
: "red"
: gameState.ballsColor;
makeParticle(
gameState,
ball.x,
ball.y,
(Math.random() - 0.5) * gameState.baseSpeed,
(Math.random() - 0.5) * gameState.baseSpeed,
gameState.ballsColor,
false,
gameState.perks.pierce_color || remainingPierce
? -ball.vx + ((Math.random() - 0.5) * gameState.baseSpeed) / 3
: (Math.random() - 0.5) * gameState.baseSpeed,
gameState.perks.pierce_color || remainingPierce
? -ball.vy + ((Math.random() - 0.5) * gameState.baseSpeed) / 3
: (Math.random() - 0.5) * gameState.baseSpeed,
color,
true,
gameState.coinSize / 2,
100 * ball.sparks,
100,
);
ball.sparks = 0;
}
}
}

1
src/types.d.ts vendored
View file

@ -94,7 +94,6 @@ export type Ball = {
previousVY: number;
sx: number;
sy: number;
sparks: number;
piercedSinceBounce: number;
hitSinceBounce: number;
hitItem: { index: number; color: string }[];