mirror of
https://github.com/He4eT/DotDashPit.git
synced 2026-05-04 17:37:23 +00:00
game: merge interface and arena state
This commit is contained in:
parent
a7435e2a9f
commit
348eb78bb8
1 changed files with 14 additions and 14 deletions
28
game.js
28
game.js
|
|
@ -24,18 +24,18 @@ let currentStage = 'mainMenu'
|
||||||
|
|
||||||
// State
|
// State
|
||||||
|
|
||||||
let interface = {
|
|
||||||
arenaX: 7,
|
|
||||||
arenaY: 7,
|
|
||||||
spriteSize: 7,
|
|
||||||
spriteHalfSize: 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
let arena = {
|
let arena = {
|
||||||
|
// Screen position
|
||||||
|
x: 7,
|
||||||
|
y: 7,
|
||||||
|
// Bounds
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 225,
|
right: 225,
|
||||||
bottom: 89,
|
bottom: 89,
|
||||||
left: 0,
|
left: 0,
|
||||||
|
// Sprite size
|
||||||
|
spriteSize: 7,
|
||||||
|
spriteHalfSize: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
let player = {
|
let player = {
|
||||||
|
|
@ -54,24 +54,24 @@ function mainMenu() {
|
||||||
currentStage = 'gameplay'
|
currentStage = 'gameplay'
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = 'Morse Pit'
|
|
||||||
const instruction = 'Press any key to start'
|
|
||||||
|
|
||||||
cls(0)
|
cls(0)
|
||||||
|
|
||||||
|
const title = 'Morse Pit'
|
||||||
print(title, 12, 12, 3, false, 2)
|
print(title, 12, 12, 3, false, 2)
|
||||||
|
|
||||||
|
const instruction = 'Press any key to start'
|
||||||
print(instruction, 12, 30, 4)
|
print(instruction, 12, 30, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gameover
|
// Gameover
|
||||||
|
|
||||||
function gameover() {
|
function gameover() {
|
||||||
const title = 'Game Over'
|
|
||||||
|
|
||||||
cls(0)
|
cls(0)
|
||||||
|
|
||||||
drawEnemies()
|
drawEnemies()
|
||||||
drawPlayer()
|
drawPlayer()
|
||||||
|
|
||||||
|
const title = 'Game Over'
|
||||||
print(title, 12, 12, 10, false, 2)
|
print(title, 12, 12, 10, false, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,8 +141,8 @@ function drawSprite(spriteIndex, x, y) {
|
||||||
const colorkey = 0
|
const colorkey = 0
|
||||||
spr(
|
spr(
|
||||||
spriteIndex,
|
spriteIndex,
|
||||||
interface.arenaX + x - interface.spriteHalfSize,
|
arena.x + x - arena.spriteHalfSize,
|
||||||
interface.arenaY + y - interface.spriteHalfSize,
|
arena.y + y - arena.spriteHalfSize,
|
||||||
colorkey,
|
colorkey,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue