Merge remote-tracking branch 'origin/master'
Conflicts: public/images/layers.png
This commit is contained in:
commit
8132294369
3 changed files with 28 additions and 7 deletions
BIN
public/images/Thumbs.db
Normal file
BIN
public/images/Thumbs.db
Normal file
Binary file not shown.
|
@ -15,14 +15,21 @@ class Tile extends BaseEntity
|
||||||
@currentLayer = 0
|
@currentLayer = 0
|
||||||
@isActive = false
|
@isActive = false
|
||||||
|
|
||||||
|
died: false
|
||||||
|
|
||||||
click: (button)->
|
click: (button)->
|
||||||
if button == "left"
|
if button == "left" and !@died
|
||||||
if @layers[@currentLayer].collect()
|
if @layers[@currentLayer].collect()
|
||||||
name = app.layerIndexToName(@currentLayer)
|
name = app.layerIndexToName(@currentLayer)
|
||||||
app.game.resources[name] += 1
|
app.game.resources[name] += 1
|
||||||
else
|
else
|
||||||
@currentLayer += 1
|
@currentLayer += 1
|
||||||
|
|
||||||
|
if @currentLayer > Object.keys(app.game.resources).length
|
||||||
|
@died = true
|
||||||
|
|
||||||
|
@currentMiner = null if @currentMiner
|
||||||
|
|
||||||
tick: ->
|
tick: ->
|
||||||
@currentMiner.tick @
|
@currentMiner.tick @
|
||||||
|
|
||||||
|
@ -45,6 +52,10 @@ class Tile extends BaseEntity
|
||||||
detachMiner: ->
|
detachMiner: ->
|
||||||
@currentMiner = null
|
@currentMiner = null
|
||||||
|
|
||||||
|
gameTick: ->
|
||||||
|
if @currentMiner
|
||||||
|
@layers[@currentLayer].collect()
|
||||||
|
|
||||||
render: (x, y)->
|
render: (x, y)->
|
||||||
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
|
||||||
|
|
|
@ -6,6 +6,9 @@ app.game =
|
||||||
@currentHoveredTile = new Tile
|
@currentHoveredTile = new Tile
|
||||||
@currentSelectedTile = new Tile
|
@currentSelectedTile = new Tile
|
||||||
|
|
||||||
|
# Start the game tick
|
||||||
|
window.setInterval(@gameTick, 1000)
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
for tile, i in @map
|
for tile, i in @map
|
||||||
y = Math.floor(i/20)
|
y = Math.floor(i/20)
|
||||||
|
@ -41,6 +44,9 @@ app.game =
|
||||||
@currentSelectedTile.deselect() if @currentSelectedTile
|
@currentSelectedTile.deselect() if @currentSelectedTile
|
||||||
@currentSelectedTile = null
|
@currentSelectedTile = null
|
||||||
|
|
||||||
|
gameTick: ->
|
||||||
|
tile.gameTick() for tile in @map
|
||||||
|
|
||||||
createMiner: ->
|
createMiner: ->
|
||||||
if @currentSelectedTile and @checkRessources 'lubinit', 30, true
|
if @currentSelectedTile and @checkRessources 'lubinit', 30, true
|
||||||
newMiner = new Miner
|
newMiner = new Miner
|
||||||
|
@ -71,7 +77,11 @@ app.game =
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
stardust: 0
|
stardust: 0
|
||||||
|
dirt: 0
|
||||||
bedrock: 0
|
bedrock: 0
|
||||||
lubinit: 0
|
|
||||||
oxodum: 0
|
oxodum: 0
|
||||||
|
lubinit: 0
|
||||||
|
darkana: 0
|
||||||
|
bio: 0
|
||||||
notch: 0
|
notch: 0
|
||||||
|
lava: 0
|
||||||
|
|
Loading…
Reference in a new issue