diff --git a/src/gameobjects/pause.ts b/src/gameobjects/pause.ts index be17ed1..8381777 100644 --- a/src/gameobjects/pause.ts +++ b/src/gameobjects/pause.ts @@ -13,7 +13,16 @@ export function addPause() { } }) - const pauseMenu = add([ + const modal = add([ + rect(width(), height()), + color(0, 0, 0), + opacity(0.5), + fixed(), + ]) + + modal.hidden = true + + const pauseMenu = modal.add([ rect(340, 300), color(255, 255, 255), outline(4), @@ -21,8 +30,6 @@ export function addPause() { pos(x, y + 700), ]) - pauseMenu.hidden = true - addButton({ width: 200, height: 80, @@ -64,11 +71,9 @@ export function addPause() { ) if (game.paused) { - pauseMenu.hidden = false + modal.hidden = false } else { - currentTween.onEnd(() => { - pauseMenu.hidden = true - }) + modal.hidden = true } } }