mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-22 04:56:15 -04:00
Fix with explosions
This commit is contained in:
parent
3a72ae005b
commit
35ea8e952a
4 changed files with 14 additions and 13 deletions
|
@ -22,7 +22,6 @@ If the app stutters, turn on "fast mode" in the settings to render a simplified
|
||||||
There's also an easy mode for kids (slower ball).
|
There's also an easy mode for kids (slower ball).
|
||||||
|
|
||||||
# Todo
|
# Todo
|
||||||
- ascetism red coins
|
|
||||||
- strict sample size red borders ?
|
- strict sample size red borders ?
|
||||||
- zen : red border on bombs
|
- zen : red border on bombs
|
||||||
- add marching ants effect + disable animation toggle
|
- add marching ants effect + disable animation toggle
|
||||||
|
|
11
dist/index.html
vendored
11
dist/index.html
vendored
|
@ -2689,7 +2689,7 @@ function explosionAt(gameState, index, x, y, ball) {
|
||||||
if (gameState.bricks[i] && i !== -1) {
|
if (gameState.bricks[i] && i !== -1) {
|
||||||
// Study bricks resist explosions too
|
// Study bricks resist explosions too
|
||||||
gameState.brickHP[i]--;
|
gameState.brickHP[i]--;
|
||||||
if (gameState.brickHP <= 0) explodeBrick(gameState, i, ball, true);
|
if (gameState.brickHP[i] <= 0) explodeBrick(gameState, i, ball, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3629,10 +3629,11 @@ let cachedBricksRender = document.createElement("canvas");
|
||||||
let cachedBricksRenderKey = "";
|
let cachedBricksRenderKey = "";
|
||||||
function renderAllBricks() {
|
function renderAllBricks() {
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
const redBorderOnBricksWithWrongColor = (0, _game.gameState).combo > (0, _gameStateMutators.baseCombo)((0, _game.gameState)) && (0, _game.gameState).perks.picky_eater && !(0, _options.isOptionOn)("basic");
|
const hasCombo = (0, _game.gameState).combo > (0, _gameStateMutators.baseCombo)((0, _game.gameState));
|
||||||
const redColorOnAllBricks = !!((0, _game.gameState).lastPuckMove && (0, _game.gameState).perks.passive_income && (0, _game.gameState).combo > (0, _gameStateMutators.baseCombo)((0, _game.gameState)) && (0, _game.gameState).lastPuckMove > (0, _game.gameState).levelTime - 250 * (0, _game.gameState).perks.passive_income);
|
const redBorderOnBricksWithWrongColor = hasCombo && (0, _game.gameState).perks.picky_eater && !(0, _options.isOptionOn)("basic");
|
||||||
|
const redColorOnAllBricks = !!((0, _game.gameState).lastPuckMove && (0, _game.gameState).perks.passive_income && hasCombo && (0, _game.gameState).lastPuckMove > (0, _game.gameState).levelTime - 250 * (0, _game.gameState).perks.passive_income);
|
||||||
let offset = getDashOffset((0, _game.gameState));
|
let offset = getDashOffset((0, _game.gameState));
|
||||||
if (!(redBorderOnBricksWithWrongColor || redColorOnAllBricks || (0, _game.gameState).perks.reach)) offset = 0;
|
if (!(redBorderOnBricksWithWrongColor || redColorOnAllBricks || (0, _game.gameState).perks.reach || (0, _game.gameState).perks.zen)) offset = 0;
|
||||||
const clairVoyance = (0, _game.gameState).perks.clairvoyant && (0, _game.gameState).brickHP.reduce((a, b)=>a + b, 0);
|
const clairVoyance = (0, _game.gameState).perks.clairvoyant && (0, _game.gameState).brickHP.reduce((a, b)=>a + b, 0);
|
||||||
const newKey = (0, _game.gameState).gameZoneWidth + "_" + (0, _game.gameState).bricks.join("_") + bombSVG.complete + "_" + redBorderOnBricksWithWrongColor + "_" + redColorOnAllBricks + "_" + (0, _game.gameState).ballsColor + "_" + (0, _game.gameState).perks.pierce_color + "_" + clairVoyance + '_' + offset;
|
const newKey = (0, _game.gameState).gameZoneWidth + "_" + (0, _game.gameState).bricks.join("_") + bombSVG.complete + "_" + redBorderOnBricksWithWrongColor + "_" + redColorOnAllBricks + "_" + (0, _game.gameState).ballsColor + "_" + (0, _game.gameState).perks.pierce_color + "_" + clairVoyance + '_' + offset;
|
||||||
if (newKey !== cachedBricksRenderKey) {
|
if (newKey !== cachedBricksRenderKey) {
|
||||||
|
@ -3648,7 +3649,7 @@ function renderAllBricks() {
|
||||||
const x = (0, _gameUtils.brickCenterX)((0, _game.gameState), index), y = (0, _gameUtils.brickCenterY)((0, _game.gameState), index);
|
const x = (0, _gameUtils.brickCenterX)((0, _game.gameState), index), y = (0, _gameUtils.brickCenterY)((0, _game.gameState), index);
|
||||||
if (!color) return;
|
if (!color) return;
|
||||||
let redBecauseOfReach = (0, _game.gameState).perks.reach && (0, _gameUtils.countBricksAbove)((0, _game.gameState), index) && !(0, _gameUtils.countBricksBelow)((0, _game.gameState), index);
|
let redBecauseOfReach = (0, _game.gameState).perks.reach && (0, _gameUtils.countBricksAbove)((0, _game.gameState), index) && !(0, _gameUtils.countBricksBelow)((0, _game.gameState), index);
|
||||||
let redBorder = (0, _game.gameState).ballsColor !== color && color !== "black" && redBorderOnBricksWithWrongColor || redBecauseOfReach || redColorOnAllBricks;
|
let redBorder = (0, _game.gameState).ballsColor !== color && color !== "black" && redBorderOnBricksWithWrongColor || hasCombo && (0, _game.gameState).perks.zen && color === 'black' || redBecauseOfReach || redColorOnAllBricks;
|
||||||
canctx.globalCompositeOperation = "source-over";
|
canctx.globalCompositeOperation = "source-over";
|
||||||
drawBrick(canctx, color, x, y, redBorder ? offset : -1);
|
drawBrick(canctx, color, x, y, redBorder ? offset : -1);
|
||||||
if ((0, _game.gameState).brickHP[index] > 1 && (0, _game.gameState).perks.clairvoyant) {
|
if ((0, _game.gameState).brickHP[index] > 1 && (0, _game.gameState).perks.clairvoyant) {
|
||||||
|
|
|
@ -284,7 +284,7 @@ export function explosionAt(
|
||||||
if (gameState.bricks[i] && i !== -1) {
|
if (gameState.bricks[i] && i !== -1) {
|
||||||
// Study bricks resist explosions too
|
// Study bricks resist explosions too
|
||||||
gameState.brickHP[i]--;
|
gameState.brickHP[i]--;
|
||||||
if (gameState.brickHP <= 0) {
|
if (gameState.brickHP[i] <= 0) {
|
||||||
explodeBrick(gameState, i, ball, true);
|
explodeBrick(gameState, i, ball, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,19 +406,20 @@ let cachedBricksRenderKey = "";
|
||||||
export function renderAllBricks() {
|
export function renderAllBricks() {
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
|
|
||||||
|
const hasCombo=gameState.combo > baseCombo(gameState)
|
||||||
const redBorderOnBricksWithWrongColor =
|
const redBorderOnBricksWithWrongColor =
|
||||||
gameState.combo > baseCombo(gameState) &&
|
hasCombo &&
|
||||||
gameState.perks.picky_eater &&
|
gameState.perks.picky_eater &&
|
||||||
!isOptionOn("basic");
|
!isOptionOn("basic");
|
||||||
|
|
||||||
const redColorOnAllBricks = !!(gameState.lastPuckMove &&
|
const redColorOnAllBricks = !!(gameState.lastPuckMove &&
|
||||||
gameState.perks.passive_income &&
|
gameState.perks.passive_income &&
|
||||||
gameState.combo > baseCombo(gameState) &&
|
hasCombo &&
|
||||||
gameState.lastPuckMove >
|
gameState.lastPuckMove >
|
||||||
gameState.levelTime - 250 * gameState.perks.passive_income)
|
gameState.levelTime - 250 * gameState.perks.passive_income)
|
||||||
|
|
||||||
let offset = getDashOffset(gameState)
|
let offset = getDashOffset(gameState)
|
||||||
if (!(redBorderOnBricksWithWrongColor || redColorOnAllBricks || gameState.perks.reach)) {
|
if (!(redBorderOnBricksWithWrongColor || redColorOnAllBricks || gameState.perks.reach || gameState.perks.zen)) {
|
||||||
offset = 0
|
offset = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +443,7 @@ export function renderAllBricks() {
|
||||||
"_" +
|
"_" +
|
||||||
clairVoyance + '_' + offset;
|
clairVoyance + '_' + offset;
|
||||||
|
|
||||||
if (newKey !== cachedBricksRenderKey) {
|
if (newKey !== cachedBricksRenderKey ) {
|
||||||
cachedBricksRenderKey = newKey;
|
cachedBricksRenderKey = newKey;
|
||||||
|
|
||||||
cachedBricksRender.width = gameState.gameZoneWidth;
|
cachedBricksRender.width = gameState.gameZoneWidth;
|
||||||
|
@ -468,7 +469,7 @@ export function renderAllBricks() {
|
||||||
let redBorder =
|
let redBorder =
|
||||||
(gameState.ballsColor !== color &&
|
(gameState.ballsColor !== color &&
|
||||||
color !== "black" &&
|
color !== "black" &&
|
||||||
redBorderOnBricksWithWrongColor) ||
|
redBorderOnBricksWithWrongColor) || (hasCombo && gameState.perks.zen && color==='black')||
|
||||||
redBecauseOfReach || redColorOnAllBricks;
|
redBecauseOfReach || redColorOnAllBricks;
|
||||||
|
|
||||||
canctx.globalCompositeOperation = "source-over";
|
canctx.globalCompositeOperation = "source-over";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue