diff options
author | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-23 18:32:29 +0100 |
---|---|---|
committer | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-23 18:32:29 +0100 |
commit | a840990bdcabf45fb0d377478ba0ab27222434ae (patch) | |
tree | 030a6c3a6befce284733f5643d3972e3a1504bb2 /src/engine.js |
initial commit
Diffstat (limited to 'src/engine.js')
-rw-r--r-- | src/engine.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/engine.js b/src/engine.js new file mode 100644 index 0000000..a7bb8a5 --- /dev/null +++ b/src/engine.js @@ -0,0 +1,34 @@ +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" + +export class Engine { + static frame = 0 + static audio + static screen = new Screen() + static keys = keys + static bgm + + static startEngine() { + setUpKeyboard() + start() + + startClock() + } + + static updateEngine() { + update() + draw() + } + + static playSound(file) { + let audio = new Audio(file) + audio.play() + } + + static playMusic(file) { + this.bgm = new Audio(file) + this.bgm.play() + } +} |