From 6134c645147a4717b38e13649374a8db54d0ed21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20M=C3=BCller?= Date: Sat, 6 Dec 2014 20:51:21 +0100 Subject: [PATCH] Working on tiles --- src/entities/tile.coffee | 7 ++++++- src/game.coffee | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/entities/tile.coffee b/src/entities/tile.coffee index 3985b03..3b50069 100644 --- a/src/entities/tile.coffee +++ b/src/entities/tile.coffee @@ -15,14 +15,19 @@ class Tile extends BaseEntity @currentLayer = 0 @isActive = false + died: false + click: (button)-> - if button == "left" + if button == "left" and !@died if @layers[@currentLayer].collect() name = app.layerIndexToName(@currentLayer) app.game.resources[name] += 1 else @currentLayer += 1 + if @currentLayer > app.game.resources.length + @died = true + tick: -> @currentMiner.tick @ diff --git a/src/game.coffee b/src/game.coffee index 04e5800..504a191 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -71,7 +71,11 @@ app.game = resources: stardust: 0 + dirt: 0 bedrock: 0 - lubinit: 0 oxodum: 0 + lubinit: 0 + darkana: 0 + bio: 0 notch: 0 + lava: 0