ld31-space-diggers/src/tiles/tilelayer.coffee

12 lines
327 B
CoffeeScript

class Tilelayer
constructor: (options)->
{@type, @depth, @amount} = options
@randomFactor = getRandomInt 0, 4
@sprite = [@randomFactor*8, @depth*8, 8, 8]
@spritedetail = [0, @depth*16, 16, 16]
@hudSprite = [@randomFactor*8, @depth*8, 4, 4]
collect: ->
return false if @amount == 0
@amount -= 1