Added animations
This commit is contained in:
parent
74cd1bdf4c
commit
c62cc69d15
2 changed files with 23 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue