diff --git a/src/entities/base.coffee b/src/entities/base.coffee index db3dc3c..46d36fe 100644 --- a/src/entities/base.coffee +++ b/src/entities/base.coffee @@ -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 - diff --git a/src/entities/miner.coffee b/src/entities/miner.coffee index 82ea4e3..99cf553 100644 --- a/src/entities/miner.coffee +++ b/src/entities/miner.coffee @@ -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