From 3daf7f0edf22919eed04c9bf67e15cc38e71cd24 Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Sat, 6 Dec 2014 18:09:54 +0100 Subject: [PATCH] Pimpt the progress bar --- src/entities/tile.coffee | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/entities/tile.coffee b/src/entities/tile.coffee index 8692fbd..0557223 100644 --- a/src/entities/tile.coffee +++ b/src/entities/tile.coffee @@ -16,7 +16,6 @@ class Tile extends BaseEntity @isActive = false click: (button)-> - #@isSelected = true if button == "left" if @layers[@currentLayer].collect() name = app.layerIndexToName(@currentLayer) @@ -30,22 +29,16 @@ class Tile extends BaseEntity moveOut: -> @isActive = false - tick: (delta) -> - # TODO: digging deeper? - render: (x, y)-> tileLayer = @layers[@currentLayer] app.layer.drawRegion app.images.layers, tileLayer.sprite, x*8, y*8 - #if @isSelected - # app.layer.drawImage app.images.selected, x*8, y*8 if @isActive app.layer.drawImage app.images.active, x*8, y*8 - # Draw the status indicator. - for i in [0..5] - color = "#0a0" - color = "#0f0" if i == 5 - app.layer.setPixel(color, x*8+1+i, y*8+6) - - + # Draw the status indicator. + numPercent = Math.ceil((tileLayer.amount*6)/app.game.maxTileAmount) + for i in [0..numPercent] + color = ["#333", "#a00", "#f60", "#aa0", "#0a0", "#0a0"][numPercent] + color = ["#000", "#f00", "#f80", "#ff0", "#0f0", "#0f0"][numPercent] if i == numPercent + app.layer.setPixel(color, x*8+1+i, y*8+6)