From d157a4f07ca0f6da51269af6522874c9e0328c41 Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Sat, 6 Dec 2014 21:24:59 +0100 Subject: [PATCH] activate ticks, now we have a real game --- src/entities/tile.coffee | 6 +----- src/game.coffee | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/entities/tile.coffee b/src/entities/tile.coffee index 0ae278c..753f7b2 100644 --- a/src/entities/tile.coffee +++ b/src/entities/tile.coffee @@ -31,7 +31,7 @@ class Tile extends BaseEntity @currentMiner = null if @currentMiner tick: -> - @currentMiner.tick @ + @currentMiner.tick @ if @currentMiner moveIn: -> @isActive = true @@ -52,10 +52,6 @@ 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 diff --git a/src/game.coffee b/src/game.coffee index f9029b4..d273165 100644 --- a/src/game.coffee +++ b/src/game.coffee @@ -7,7 +7,7 @@ app.game = @currentSelectedTile = new Tile # Start the game tick - window.setInterval(@gameTick, 1000) + window.setInterval(@tick, 1000) render: -> for tile, i in @map @@ -44,8 +44,8 @@ app.game = @currentSelectedTile.deselect() if @currentSelectedTile @currentSelectedTile = null - gameTick: -> - tile.gameTick() for tile in @map + tick: => + tile.tick() for tile in app.game.map createMiner: -> if @currentSelectedTile and @checkRessources 'lubinit', 30, true