dig deep, dude!
This commit is contained in:
parent
3753b67b07
commit
8b85c12512
2 changed files with 17 additions and 9 deletions
|
@ -9,18 +9,21 @@ class Tile extends BaseEntity
|
|||
@layers.push new Tilelayer(
|
||||
type: restype,
|
||||
depth: i,
|
||||
amount: Math.random(5)+10
|
||||
amount: Math.round(Math.random(app.game.maxTileAmount-10)+10)
|
||||
)
|
||||
|
||||
@currentLayer = 0
|
||||
@isActive = false
|
||||
|
||||
click: (button)->
|
||||
@isSelected = true
|
||||
if button == "left" and @layers[@currentLayer].collect()
|
||||
name = app.layerIndexToName(@currentLayer)
|
||||
console.log(name)
|
||||
app.game.resources[name] += 1
|
||||
#@isSelected = true
|
||||
if button == "left"
|
||||
if @layers[@currentLayer].collect()
|
||||
name = app.layerIndexToName(@currentLayer)
|
||||
app.game.resources[name] += 1
|
||||
else
|
||||
@currentLayer += 1
|
||||
|
||||
|
||||
moveIn: ->
|
||||
@isActive = true
|
||||
|
@ -35,7 +38,11 @@ class Tile extends BaseEntity
|
|||
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
|
||||
else if @isActive
|
||||
#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.
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ app.game =
|
|||
@map[pos]
|
||||
|
||||
map: []
|
||||
maxTileAmount: 15
|
||||
|
||||
resources:
|
||||
stardust: 10
|
||||
|
|
Loading…
Reference in a new issue