mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-21 04:26:14 -04:00
Overcomplicated looping mechanic
This commit is contained in:
parent
5012076039
commit
39b326a15b
18 changed files with 296 additions and 125 deletions
|
@ -200,27 +200,49 @@ export function render(gameState: GameState) {
|
|||
);
|
||||
});
|
||||
|
||||
if (gameState.debuffs.negative_coins) {
|
||||
if (gameState.debuffs.deadly_coins || gameState.debuffs.frozen_coins) {
|
||||
// Render crimson coins very bright
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
ctx.globalAlpha = 0.8;
|
||||
const red = Math.floor(gameState.levelTime / 100) % 2 > 0;
|
||||
forEachLiveOne(gameState.coins, (coin) => {
|
||||
if (coin.color !== "crimson") return;
|
||||
drawBall(ctx, red ? "red" : "black", coin.size * 3, coin.x, coin.y);
|
||||
if (coin.color == "crimson") {
|
||||
drawBall(ctx, red ? "red" : "black", coin.size * 3, coin.x, coin.y);
|
||||
}
|
||||
if (coin.color == "LightSkyBlue") {
|
||||
drawBall(
|
||||
ctx,
|
||||
red ? "LightSkyBlue" : "black",
|
||||
coin.size * 3,
|
||||
coin.x,
|
||||
coin.y,
|
||||
);
|
||||
}
|
||||
});
|
||||
ctx.globalAlpha = 1;
|
||||
forEachLiveOne(gameState.coins, (coin) => {
|
||||
if (coin.color !== "crimson") return;
|
||||
drawCoin(
|
||||
ctx,
|
||||
!red ? "red" : "black",
|
||||
coin.size,
|
||||
coin.x,
|
||||
coin.y,
|
||||
"red",
|
||||
coin.a,
|
||||
);
|
||||
if (coin.color == "crimson") {
|
||||
drawCoin(
|
||||
ctx,
|
||||
!red ? "red" : "black",
|
||||
coin.size,
|
||||
coin.x,
|
||||
coin.y,
|
||||
"red",
|
||||
coin.a,
|
||||
);
|
||||
}
|
||||
if (coin.color == "LightSkyBlue") {
|
||||
drawCoin(
|
||||
ctx,
|
||||
!red ? "LightSkyBlue" : "black",
|
||||
coin.size,
|
||||
coin.x,
|
||||
coin.y,
|
||||
"LightSkyBlue",
|
||||
coin.a,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +346,9 @@ export function render(gameState: GameState) {
|
|||
|
||||
drawPuck(
|
||||
ctx,
|
||||
gameState.puckColor,
|
||||
gameState.puckFrozenUntil > gameState.levelTime
|
||||
? "LightSkyBlue"
|
||||
: gameState.puckColor,
|
||||
gameState.puckWidth,
|
||||
gameState.puckHeight,
|
||||
0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue