You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
826 B

const GameModule = require('../../core/game-module');
class IntroModule extends GameModule {
constructor(engine, config) {
super(engine, config);
this.state = 'welcome';
}
init() {
super.init();
this.engine.events.emit('intro:ready');
}
start() {
super.start();
console.log('Welkom bij', this.config.themeName);
// Start intro sequence
setTimeout(() => {
this.state = 'ready';
this.engine.events.emit('intro:ready_for_input');
}, 2000);
}
handleInput(key) {
if (this.state === 'ready' && key === 'Space') {
this.complete();
}
}
complete() {
this.stop();
this.engine.events.emit('intro:complete');
}
}
module.exports = IntroModule;