mirror of
https://github.com/He4eT/DotDashPit.git
synced 2026-05-05 01:47:22 +00:00
game: improve startscreen and gameover
This commit is contained in:
parent
e8bb462efd
commit
2b11620b5f
1 changed files with 10 additions and 6 deletions
16
game.js
16
game.js
|
|
@ -13,13 +13,13 @@ function TIC() {
|
||||||
/* Stages */
|
/* Stages */
|
||||||
|
|
||||||
const gameStages = {
|
const gameStages = {
|
||||||
mainMenu,
|
startscreen,
|
||||||
gameover,
|
|
||||||
gameplay,
|
gameplay,
|
||||||
|
gameover,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {keyof typeof gameStages} */
|
/** @type {keyof typeof gameStages} */
|
||||||
let currentStage = 'mainMenu'
|
let currentStage = 'startscreen'
|
||||||
|
|
||||||
/* State */
|
/* State */
|
||||||
|
|
||||||
|
|
@ -57,8 +57,8 @@ let effects = []
|
||||||
|
|
||||||
/* Main Menu */
|
/* Main Menu */
|
||||||
|
|
||||||
function mainMenu() {
|
function startscreen() {
|
||||||
if ([BTN_A, BTN_B, BTN_X, BTN_Y].map(btn).some(Boolean)) {
|
if ([BTN_A, BTN_B, BTN_X, BTN_Y].map((b) => btnp(b)).some(Boolean)) {
|
||||||
currentStage = 'gameplay'
|
currentStage = 'gameplay'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,11 +76,15 @@ function mainMenu() {
|
||||||
function gameover() {
|
function gameover() {
|
||||||
cls(0)
|
cls(0)
|
||||||
|
|
||||||
|
if ([BTN_A, BTN_B, BTN_X, BTN_Y].map((b) => btnp(b)).some(Boolean)) {
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
|
||||||
drawEnemies()
|
drawEnemies()
|
||||||
drawPlayer()
|
drawPlayer()
|
||||||
|
|
||||||
const title = 'Game Over'
|
const title = 'Game Over'
|
||||||
print(title, 12, 12, 10, false, 2)
|
print(title, 12, SCREEN_H - 24, 10, false, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gameplay */
|
/* Gameplay */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue