From ddceb2fd4537020be4d409611b97bb774ca354f7 Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Sun, 7 Dec 2014 18:50:10 +0100 Subject: [PATCH] End game --- src/app.coffee | 2 +- src/game.coffee | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app.coffee b/src/app.coffee index f90657b..afa978a 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -5,7 +5,7 @@ app = playground( smoothing: false, create: -> - @loadImages "layers", "active", "progress", "selected", "entities", "hud", "actions", "speechbubbles", "deadtiles", "layerdetails", "entitydetails", "buildinfo", "cursor" + @loadImages "layers", "active", "progress", "selected", "entities", "hud", "actions", "speechbubbles", "deadtiles", "layerdetails", "entitydetails", "buildinfo", "cursor", "end" @currentHoveredTile = new Tile ready: -> diff --git a/src/game.coffee b/src/game.coffee index 747907c..71102aa 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -41,6 +41,10 @@ app.game = app.game.speechbubble.setMouse() render: -> + if @gameEndCheck() + app.layer.drawImage app.images.end, 0, 0, 20*8, 15*8 + return + for tile, i in @map y = Math.floor(i/20) x = i-(y*20) @@ -135,7 +139,7 @@ app.game = else @speechbubble.say 'nosel' -# TODO: OMG refactor this ... + # TODO: OMG refactor this ... createSolarpanel: -> if @currentSelectedTile if @checkPosition(@currentSelectedTile) @@ -204,6 +208,7 @@ app.game = solarpanelCount: -> energy = 0 for tile in app.game.map + # FIXME: Thats not a sane solution hahahah :D energy += 1 if tile.entity and tile.entity.energyProvided > 10 energy