Added animations

This commit is contained in:
Ruben Müller 2014-12-07 14:45:13 +01:00
parent 74cd1bdf4c
commit c62cc69d15
2 changed files with 23 additions and 3 deletions

View File

@ -1,12 +1,22 @@
class Base
constructor: ->
@frame = 0
window.setInterval @changeAnimation, 500
tick: (tile)->
sprite: ->
[0, 0, 8, 8]
[@frame*8, 0, 8, 8]
isMoveable: ->
false
changeAnimation: =>
if @frame == 3
@frame = 0
else
@frame += 1
spaceProvided: 50
isDockable: true

View File

@ -1,12 +1,22 @@
class Miner
constructor: ->
@frame = 0
window.setInterval @changeAnimation, 500
tick: (tile)->
tile.click "left"
sprite: ->
[0, 16, 8, 8]
[@frame*8, 16, 8, 8]
isMoveable: ->
true
changeAnimation: =>
if @frame == 1
@frame = 0
else
@frame += 1
spaceProvided: 5
isDockable: false