This commit is contained in:
2026-05-19 23:13:41 -05:00
parent ed6c951783
commit 677768e6ab
28 changed files with 926 additions and 44 deletions
+13 -30
View File
@@ -1,50 +1,33 @@
var CubeEntity = include('entities/CubeEntity.js');
var MoveCubeCutscene = include('cutscenes/MoveCubeCutscene.js');
function CubeScene() {
Map.load('test');
this.cam = new Entity();
this.cam.add(POSITION);
this.cam.add(CAMERA);
this.cam.position.position = new Vec3(3, 3, 3);
this.cam.position.lookAt(new Vec3(0, 0, 0));
this.cube = new CubeEntity();
this.spriteEnt = new Entity();
this.spriteEnt.add(POSITION);
this.spriteEnt.position.position = new Vec3(16, 16, 0);
this.inputEnabled = false;
var scene = this;
Cutscene.play(new MoveCubeCutscene({ cube: this.cube })).then(function() {
scene.inputEnabled = true;
});
Textbox.setText(
"Hello! This is a visual novel textbox. It automatically " +
"wraps long lines and splits into pages when the content " +
"is too tall to fit. Press advance to continue...\t" +
"This is a second paragraph on a new page."
);
this.player = new CubeEntity();
this.player.position.position = new Vec3(0, 0, 0);
}
CubeScene.prototype = Object.create(Scene.prototype);
CubeScene.prototype.constructor = CubeScene;
CubeScene.prototype.update = function() {
if(this.inputEnabled) {
this.cube.update();
}
this.player.update();
var pos = this.player.position.position;
this.cam.position.position = new Vec3(pos.x, pos.y + 8, pos.z + 8);
this.cam.position.lookAt(pos);
Map.setPosition(Math.floor(pos.x), Math.floor(pos.y), Math.floor(pos.z));
};
CubeScene.prototype.dispose = function() {
Cutscene.stop();
this.cam.dispose();
this.cube.dispose();
this.spriteEnt.dispose();
this.player.dispose();
Map.dispose();
};
module = CubeScene;