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
|
class Base
|
||||||
|
constructor: ->
|
||||||
|
@frame = 0
|
||||||
|
|
||||||
|
window.setInterval @changeAnimation, 500
|
||||||
|
|
||||||
tick: (tile)->
|
tick: (tile)->
|
||||||
|
|
||||||
sprite: ->
|
sprite: ->
|
||||||
[0, 0, 8, 8]
|
[@frame*8, 0, 8, 8]
|
||||||
|
|
||||||
isMoveable: ->
|
isMoveable: ->
|
||||||
false
|
false
|
||||||
|
|
||||||
|
changeAnimation: =>
|
||||||
|
if @frame == 3
|
||||||
|
@frame = 0
|
||||||
|
else
|
||||||
|
@frame += 1
|
||||||
|
|
||||||
spaceProvided: 50
|
spaceProvided: 50
|
||||||
isDockable: true
|
isDockable: true
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
class Miner
|
class Miner
|
||||||
|
constructor: ->
|
||||||
|
@frame = 0
|
||||||
|
window.setInterval @changeAnimation, 500
|
||||||
|
|
||||||
tick: (tile)->
|
tick: (tile)->
|
||||||
tile.click "left"
|
tile.click "left"
|
||||||
|
|
||||||
sprite: ->
|
sprite: ->
|
||||||
[0, 16, 8, 8]
|
[@frame*8, 16, 8, 8]
|
||||||
|
|
||||||
isMoveable: ->
|
isMoveable: ->
|
||||||
true
|
true
|
||||||
|
|
||||||
|
changeAnimation: =>
|
||||||
|
if @frame == 1
|
||||||
|
@frame = 0
|
||||||
|
else
|
||||||
|
@frame += 1
|
||||||
|
|
||||||
spaceProvided: 5
|
spaceProvided: 5
|
||||||
isDockable: false
|
isDockable: false
|
||||||
|
|
Loading…
Reference in a new issue