///////////////////// IMPORTS ////////////////////// import { Boshy } from "./entities/boshy.js" import { SCENE, SCENES } from "./scenes.js" ///////////////////// GLOBALS ////////////////////// export let boshy export const bullets = { list: [], remove: instance => { bullets.list = bullets.list.filter(b => b != instance) }, clear: _ => { bullets.list.forEach(b => b.remove()) } } ///////////////////// GAME LOGIC ////////////////////// export function start() { console.log("game start") changeScene(SCENES.PREQUEL) } export function update() { boshy.update() bullets.list.forEach((bullet) => bullet.update()) SCENE.update() } export function draw() { boshy.draw() bullets.list.forEach((bullet) => bullet.draw()) SCENE.draw() } ///////////////////// SCENE METHODS ////////////////////// export function changeScene(scene) { SCENE.load(scene) bullets.clear() boshy = new Boshy() }