summaryrefslogtreecommitdiff
path: root/src/engine.js
blob: 0adb528c525a4a2d2614c0033aeab52e6420e379 (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
26
27
28
29
30
import { start, update, draw } from "./main.js"
import { Screen } from "./engine/screen.js"
import { keys, setUpKeyboard } from "./engine/keyboard.js"
import { startClock } from "./engine/clock.js"
import { Radio } from "./engine/radio.js"
import { Collision } from "./engine/collision.js"

export class Engine {
    static frame = 0
    static screen = new Screen()
    static radio = new Radio()
    static collision = new Collision()
    static keys = keys

    static startEngine() {
        setUpKeyboard()
        start()
        startClock()
    }

    static updateEngine() {
        update()
        Engine.screen.update()
        draw()
    }

    static random(min, max) { 
        return Math.floor(Math.random() * (max + 1 - min) + min);
    }
}