blob: fc88b8fc7d550be13b3af2698555e6e9dd77aa12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { boshy } from "./main.js"
import { Engine } from "./engine.js"
import { BigDump } from "./entities/bigdump.js"
const maxTime = 200
const margin = 30
let timeH = 0
let timeV = 0
export function update() {
if (boshy.dead) return
timeH = (
boshy.position.x > Engine.screen.viewport.x - margin ||
boshy.position.x < margin
) ? timeH + 1 : 0
timeV = (
boshy.position.y > Engine.screen.viewport.y - margin ||
boshy.position.y < margin
) ? timeV + 1 : 0
if (timeH == maxTime) new BigDump(false)
if (timeV == maxTime) new BigDump(true)
}
|