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
|
@currentMiner = null if @currentMiner
|
||||||
|
|
||||||
tick: ->
|
tick: ->
|
||||||
@currentMiner.tick @
|
@currentMiner.tick @ if @currentMiner
|
||||||
|
|
||||||
moveIn: ->
|
moveIn: ->
|
||||||
@isActive = true
|
@isActive = true
|
||||||
|
@ -52,10 +52,6 @@ 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
|
||||||
|
|
|
@ -7,7 +7,7 @@ app.game =
|
||||||
@currentSelectedTile = new Tile
|
@currentSelectedTile = new Tile
|
||||||
|
|
||||||
# Start the game tick
|
# Start the game tick
|
||||||
window.setInterval(@gameTick, 1000)
|
window.setInterval(@tick, 1000)
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
for tile, i in @map
|
for tile, i in @map
|
||||||
|
@ -44,8 +44,8 @@ app.game =
|
||||||
@currentSelectedTile.deselect() if @currentSelectedTile
|
@currentSelectedTile.deselect() if @currentSelectedTile
|
||||||
@currentSelectedTile = null
|
@currentSelectedTile = null
|
||||||
|
|
||||||
gameTick: ->
|
tick: =>
|
||||||
tile.gameTick() for tile in @map
|
tile.tick() for tile in app.game.map
|
||||||
|
|
||||||
createMiner: ->
|
createMiner: ->
|
||||||
if @currentSelectedTile and @checkRessources 'lubinit', 30, true
|
if @currentSelectedTile and @checkRessources 'lubinit', 30, true
|
||||||
|
|
Loading…
Reference in a new issue