31 lines
688 B
TypeScript
31 lines
688 B
TypeScript
import { Engine, Loader, DisplayMode } from 'excalibur'
|
|
import { Beginning } from './scenes/beginning'
|
|
import { Player } from './actors/player'
|
|
import { Resources } from './resources'
|
|
|
|
class Game extends Engine {
|
|
private player: Player
|
|
private beginning: Beginning
|
|
|
|
constructor() {
|
|
super({ displayMode: DisplayMode.FitScreen })
|
|
}
|
|
|
|
public start() {
|
|
this.beginning = new Beginning()
|
|
this.player = new Player()
|
|
this.beginning.add(this.player)
|
|
|
|
game.add('beginning', this.beginning)
|
|
|
|
const loader = new Loader(Object.values(Resources))
|
|
|
|
return super.start(loader)
|
|
}
|
|
}
|
|
|
|
const game = new Game()
|
|
game.start().then(() => {
|
|
game.goToScene('beginning')
|
|
})
|