mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-23 21:46:15 -04:00
Fixed an issue with resizing and pacman level, changed ball attracts coins
This commit is contained in:
parent
83b9c0dec5
commit
183a11f989
10 changed files with 1837 additions and 1761 deletions
|
@ -155,7 +155,8 @@ export const fitSize = () => {
|
|||
const baseWidth = Math.round(
|
||||
Math.min(gameState.canvasWidth, gameState.gameZoneHeight * 0.73),
|
||||
);
|
||||
gameState.brickWidth = Math.floor(baseWidth / gameState.gridSize / 2) * 2;
|
||||
gameState.brickWidth = Math.floor(baseWidth / gameState.gridSize / 2) * 2;
|
||||
|
||||
gameState.gameZoneWidth = gameState.brickWidth * gameState.gridSize;
|
||||
gameState.offsetX = Math.floor(
|
||||
(gameState.canvasWidth - gameState.gameZoneWidth) / 2,
|
||||
|
@ -974,8 +975,10 @@ document.addEventListener("keyup", async (e) => {
|
|||
export const gameState = newGameState({});
|
||||
|
||||
export function restart(params: RunParams) {
|
||||
fitSize();
|
||||
// fitSize();
|
||||
Object.assign(gameState, newGameState(params));
|
||||
// Recompute brick size according to level
|
||||
fitSize();
|
||||
pauseRecording();
|
||||
setLevel(gameState, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue