Merge branch 'master' of https://github.com/arg-games/ld31
This commit is contained in:
commit
c6d131dc32
3 changed files with 15 additions and 5 deletions
Binary file not shown.
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 702 B |
|
@ -50,6 +50,10 @@ class Tile extends BaseEntity
|
|||
detachMiner: ->
|
||||
@currentMiner = null
|
||||
|
||||
gameTick: ->
|
||||
if @currentMiner
|
||||
@layers[@currentLayer].collect()
|
||||
|
||||
render: (x, y)->
|
||||
tileLayer = @layers[@currentLayer]
|
||||
app.layer.drawRegion app.images.layers, tileLayer.sprite, x*8, y*8
|
||||
|
@ -64,9 +68,9 @@ class Tile extends BaseEntity
|
|||
app.layer.drawImage app.images.active, x*8, y*8
|
||||
|
||||
# Draw the status indicator.
|
||||
numPercent = Math.floor((tileLayer.amount*6)/app.game.maxTileAmount)
|
||||
for i in [0..numPercent]
|
||||
color = ["#f00", "#a00", "#f60", "#aa0", "#0a0", "#0a0"][numPercent]
|
||||
color = ["#f00", "#f00", "#f80", "#ff0", "#0f0", "#0f0"][numPercent] if i == numPercent
|
||||
app.layer.setPixel(color, x*8+1+i, y*8+6)
|
||||
numPercent = Math.floor((tileLayer.amount*6)/app.game.maxTileAmount)
|
||||
for i in [0..numPercent]
|
||||
color = ["#f00", "#a00", "#f60", "#aa0", "#0a0", "#0a0"][numPercent]
|
||||
color = ["#f00", "#f00", "#f80", "#ff0", "#0f0", "#0f0"][numPercent] if i == numPercent
|
||||
app.layer.setPixel(color, x*8+1+i, y*8+6)
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@ app.game =
|
|||
@currentHoveredTile = new Tile
|
||||
@currentSelectedTile = new Tile
|
||||
|
||||
# Start the game tick
|
||||
window.setInterval(@gameTick, 1000)
|
||||
|
||||
render: ->
|
||||
for tile, i in @map
|
||||
y = Math.floor(i/20)
|
||||
|
@ -41,6 +44,9 @@ app.game =
|
|||
@currentSelectedTile.deselect() if @currentSelectedTile
|
||||
@currentSelectedTile = null
|
||||
|
||||
gameTick: ->
|
||||
tile.gameTick() for tile in @map
|
||||
|
||||
createMiner: ->
|
||||
if @currentSelectedTile and @checkRessources 'lubinit', 30, true
|
||||
newMiner = new Miner
|
||||
|
|
Loading…
Reference in a new issue