From 3f8532a8308aeeb988de97a91e2365b6ae01ccdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20M=C3=BCller?= Date: Sun, 7 Dec 2014 13:32:10 +0100 Subject: [PATCH] Show selected entities in HUD --- notes.org | 2 +- src/hud.coffee | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/notes.org b/notes.org index d6aced7..9cb52e5 100644 --- a/notes.org +++ b/notes.org @@ -10,4 +10,4 @@ Title: Entire game on one screen ** Spielstart in irgend einer weise ... (grafik) ** Hint für shortcuts anzeigen :ruben: ** Preise für entities :ruben: -** Mauszeiger fixen :ruben: +** Silos: Farben je nach Kapazität einfärben \ No newline at end of file diff --git a/src/hud.coffee b/src/hud.coffee index a8f6853..b1dbe71 100644 --- a/src/hud.coffee +++ b/src/hud.coffee @@ -14,8 +14,12 @@ app.game.hud = render: -> app.layer.drawImage app.images.hud, 0, 11*8 - if app.game.currentSelectedTile != null - app.layer.drawRegion app.images.layers, app.game.currentSelectedTile.getCurrentLayer().sprite, 15, 100 + currentSelectedTile = app.game.currentSelectedTile + if currentSelectedTile != null + app.layer.drawRegion app.images.layers, currentSelectedTile.getCurrentLayer().sprite, 15, 100 + + if currentSelectedTile.entity + app.layer.drawRegion app.images.entities, currentSelectedTile.entity.sprite(), 15, 100 # silo capacity usedSiloStoragePercent = (100 / app.game.availableSiloStorage()) * app.game.usedSiloStorage()