mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-22 04:56:15 -04:00
Game state now contains a map of sounds to play next, for better perf
This commit is contained in:
parent
efa634cd8f
commit
581ee412d4
10 changed files with 1326 additions and 1153 deletions
|
@ -8,7 +8,7 @@ import {
|
|||
RunParams,
|
||||
Upgrade,
|
||||
} from "./types";
|
||||
import { getAudioContext } from "./sounds";
|
||||
import {getAudioContext, playPendingSounds} from "./sounds";
|
||||
import {
|
||||
currentLevelInfo,
|
||||
getRowColIndex,
|
||||
|
@ -429,7 +429,6 @@ export function bordersHitCheck(
|
|||
|
||||
return hhit + vhit * 2;
|
||||
}
|
||||
|
||||
export function tick() {
|
||||
const currentTick = performance.now();
|
||||
const timeDeltaMs = currentTick - gameState.lastTick;
|
||||
|
@ -458,6 +457,9 @@ export function tick() {
|
|||
if (gameState.running) {
|
||||
recordOneFrame(gameState);
|
||||
}
|
||||
if(isOptionOn('sound') ){
|
||||
playPendingSounds(gameState)
|
||||
}
|
||||
requestAnimationFrame(tick);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue