|
|
|
@ -15,32 +15,34 @@ app.game =
|
|
|
|
|
@hud.start()
|
|
|
|
|
@speechbubble.start()
|
|
|
|
|
|
|
|
|
|
@cutScene = true
|
|
|
|
|
@cutSceneImage = app.images.intro1
|
|
|
|
|
|
|
|
|
|
@cutScene = false
|
|
|
|
|
@intro = false
|
|
|
|
|
@startCutScene()
|
|
|
|
|
@titleScreen = true
|
|
|
|
|
|
|
|
|
|
# TODO: Refactor this whole crap ... I can't belive I am writing rthis ...
|
|
|
|
|
# TODO: Refactor this whole crap ... I can't belive I am writing this ...
|
|
|
|
|
startCutScene: ->
|
|
|
|
|
window.setTimeout @cutScene2, 500
|
|
|
|
|
if @titleScreen
|
|
|
|
|
@titleScreen = false
|
|
|
|
|
@cutScene = true
|
|
|
|
|
app.game.cutSceneImage = app.images.intro1
|
|
|
|
|
window.setTimeout app.game.cutScene2, 1500
|
|
|
|
|
|
|
|
|
|
cutScene2: =>
|
|
|
|
|
@cutSceneImage = app.images.intro2
|
|
|
|
|
window.setTimeout @cutScene3, 500
|
|
|
|
|
app.game.cutSceneImage = app.images.intro2
|
|
|
|
|
window.setTimeout app.game.cutScene3, 2000
|
|
|
|
|
|
|
|
|
|
cutScene3: =>
|
|
|
|
|
@cutSceneImage = app.images.intro3
|
|
|
|
|
window.setTimeout @cutScene4, 500
|
|
|
|
|
app.game.cutSceneImage = app.images.intro3
|
|
|
|
|
window.setTimeout app.game.cutScene4, 1500
|
|
|
|
|
|
|
|
|
|
cutScene4: =>
|
|
|
|
|
@cutSceneImage = app.images.intro4
|
|
|
|
|
window.setTimeout @cutSceneEnd, 500
|
|
|
|
|
app.game.cutSceneImage = app.images.intro4
|
|
|
|
|
window.setTimeout app.game.cutSceneEnd, 1500
|
|
|
|
|
|
|
|
|
|
cutSceneEnd: =>
|
|
|
|
|
@cutScene = false
|
|
|
|
|
@intro = true
|
|
|
|
|
@startIntro()
|
|
|
|
|
app.game.cutScene = false
|
|
|
|
|
app.game.intro = true
|
|
|
|
|
app.game.startIntro()
|
|
|
|
|
|
|
|
|
|
startIntro: ->
|
|
|
|
|
@speechbubble.setFix 90, 27
|
|
|
|
@ -65,6 +67,10 @@ app.game =
|
|
|
|
|
app.game.speechbubble.setMouse()
|
|
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
|
if @titleScreen
|
|
|
|
|
app.layer.drawImage app.images.titlescreen, 0, 0, 20*8, 15*8
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if @cutScene
|
|
|
|
|
app.layer.drawImage @cutSceneImage, 0, 0, 20*8, 15*8
|
|
|
|
|
return
|
|
|
|
@ -125,6 +131,7 @@ app.game =
|
|
|
|
|
|
|
|
|
|
keyup: (event) ->
|
|
|
|
|
switch event.key
|
|
|
|
|
when "enter" then @startCutScene()
|
|
|
|
|
when "m" then @createMiner()
|
|
|
|
|
when "e" then @createSolarpanel()
|
|
|
|
|
when "i" then app.game.hud.showBuildInfo()
|
|
|
|
|