Skip to content

Commit

Permalink
feat(gameobjects): add modal to pause screen
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 28, 2025
1 parent 28d1322 commit 65fa6da
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/gameobjects/pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ 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),
anchor('center'),
pos(x, y + 700),
])

pauseMenu.hidden = true

addButton({
width: 200,
height: 80,
Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 65fa6da

Please sign in to comment.