summaryrefslogtreecommitdiff
path: root/src/engine.js
blob: 1d7114868a04ce2ef52b001a470e9ccaa310f30f (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
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()
        draw()
    }

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