ld31-space-diggers/src/items/animateditem.coffee
2014-12-07 13:48:12 +01:00

16 lines
266 B
CoffeeScript

class AnimatedItem
constructor: (options) ->
{@maxFrames, @image}
@frame = 0
window.setInterval @changeAnimation, 500
sprite: ->
[@frame*8, 8, 8, 8]
changeAnimation: =>
if @frame == @maxFrames
@frame = 0
else
@frame += 1