activate ticks, now we have a real game
This commit is contained in:
parent
4d7a9412f1
commit
d157a4f07c
2 changed files with 4 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue