Skip to content

Commit

Permalink
feat(scenes): add button to go to title in lose
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 29, 2025
1 parent a938280 commit 63d3ced
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/scenes/lose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,40 @@ import { addButton, addText } from '../gameobjects'

scene(Scene.Lose, () => {
const { x, y } = center()
const margin = 100
const buttonHeight = 80

addText({
width: 400,
height: 100,
x,
y: y - margin,
y: y - buttonHeight * 2,
text: 'Game Over',
fontSize: 48,
})

addButton({
width: 220,
height: 80,
height: buttonHeight,
radius: 8,
x,
y: y + margin,
y: y + buttonHeight,
text: 'Restart',
onClick() {
play(Sound.Hit)
go(Scene.Game)
},
})

addButton({
width: 220,
height: buttonHeight,
radius: 8,
x,
y: y + buttonHeight * 2 + 20,
text: 'Exit',
onClick() {
play(Sound.Hit)
go(Scene.Title)
},
})
})

0 comments on commit 63d3ced

Please sign in to comment.