dig deep, dude!

This commit is contained in:
Aaron Mueller 2014-12-06 17:32:37 +01:00
parent 3753b67b07
commit 8b85c12512
2 changed files with 17 additions and 9 deletions

View file

@ -9,18 +9,21 @@ class Tile extends BaseEntity
@layers.push new Tilelayer( @layers.push new Tilelayer(
type: restype, type: restype,
depth: i, depth: i,
amount: Math.random(5)+10 amount: Math.round(Math.random(app.game.maxTileAmount-10)+10)
) )
@currentLayer = 0 @currentLayer = 0
@isActive = false @isActive = false
click: (button)-> click: (button)->
@isSelected = true #@isSelected = true
if button == "left" and @layers[@currentLayer].collect() if button == "left"
name = app.layerIndexToName(@currentLayer) if @layers[@currentLayer].collect()
console.log(name) name = app.layerIndexToName(@currentLayer)
app.game.resources[name] += 1 app.game.resources[name] += 1
else
@currentLayer += 1
moveIn: -> moveIn: ->
@isActive = true @isActive = true
@ -35,7 +38,11 @@ class Tile extends BaseEntity
tileLayer = @layers[@currentLayer] tileLayer = @layers[@currentLayer]
app.layer.drawRegion app.images.layers, tileLayer.sprite, x*8, y*8 app.layer.drawRegion app.images.layers, tileLayer.sprite, x*8, y*8
if @isSelected #if @isSelected
app.layer.drawImage app.images.selected, x*8, y*8 # app.layer.drawImage app.images.selected, x*8, y*8
else if @isActive if @isActive
app.layer.drawImage app.images.active, x*8, y*8 app.layer.drawImage app.images.active, x*8, y*8
# Draw the status indicator.

View file

@ -39,6 +39,7 @@ app.game =
@map[pos] @map[pos]
map: [] map: []
maxTileAmount: 15
resources: resources:
stardust: 10 stardust: 10