Testing cutscenes

This commit is contained in:
2026-05-05 22:10:47 -05:00
parent 3bc544fba1
commit 6da02b25fa
14 changed files with 786 additions and 2 deletions
+34
View File
@@ -0,0 +1,34 @@
var PHASE_LEFT = 0;
var PHASE_RIGHT = 1;
var SPEED = 3.0;
var DURATION = 2.0;
function MoveCubeCutscene(params) {
Cutscene.call(this);
this.cube = params.cube;
this.phase = PHASE_LEFT;
this.timer = 0.0;
}
MoveCubeCutscene.prototype = Object.create(Cutscene.prototype);
MoveCubeCutscene.prototype.constructor = MoveCubeCutscene;
MoveCubeCutscene.prototype.update = function() {
this.timer += TIME.delta;
if(this.phase === PHASE_LEFT) {
this.cube.position.position.x -= SPEED * TIME.delta;
if(this.timer >= DURATION) {
this.phase = PHASE_RIGHT;
this.timer = 0.0;
}
} else if(this.phase === PHASE_RIGHT) {
this.cube.position.position.x += SPEED * TIME.delta;
if(this.timer >= DURATION) {
Cutscene.finish();
}
}
};
module = MoveCubeCutscene;