var Player = require('./Player.js'); var PlayerCamera = require('./PlayerCamera.js'); var TestPlane = require('./TestPlane.js'); class OverworldScene { constructor() { } init() { this.player = new Player(); this.plane = new TestPlane(); this.camera = new PlayerCamera(this.player); this.rect = new Rectangle(); this.rect.color = { r: 255, g: 0, b: 0, a: 255 }; this.rect.width = 100; this.rect.height = 100; UI.add(this.rect); this.label = new Label(); this.label.text = 'Hello World!'; this.rect.add(this.label); } lateUpdate() { this.camera.update(); } dispose() { this.camera.dispose(); this.player.dispose(); this.plane.dispose(); // rect.dispose() cascades to label (added as its child) and removes // itself from UI's render roots -- no separate UI.remove()/dispose() // needed for either. this.rect.dispose(); this.camera = null; this.player = null; this.plane = null; this.label = null; this.rect = null; } } module.exports = OverworldScene;