diff --git a/src/game.coffee b/src/game.coffee index dbde3cf..cd10bda 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -15,6 +15,30 @@ app.game = @hud.start() @speechbubble.start() + @cutScene = true + @cutSceneImage = app.images.intro1 + + @intro = false + @startCutScene() + + # TODO: Refactor this whole crap ... I can't belive I am writing rthis ... + startCutScene: -> + window.setTimeout @cutScene2, 500 + + cutScene2: => + @cutSceneImage = app.images.intro2 + window.setTimeout @cutScene3, 500 + + cutScene3: => + @cutSceneImage = app.images.intro3 + window.setTimeout @cutScene4, 500 + + cutScene4: => + @cutSceneImage = app.images.intro4 + window.setTimeout @cutSceneEnd, 500 + + cutSceneEnd: => + @cutScene = false @intro = true @startIntro() @@ -41,6 +65,10 @@ app.game = app.game.speechbubble.setMouse() render: -> + if @cutScene + app.layer.drawImage @cutSceneImage, 0, 0, 20*8, 15*8 + return + if @gameEndCheck() app.layer.drawImage app.images.end, 0, 0, 20*8, 15*8 return