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

19 lines
536 B
CoffeeScript
Raw Normal View History

2014-12-06 12:37:57 +01:00
class Tilelayer extends BaseEntity
2014-12-06 09:16:55 +01:00
constructor: (options) ->
2014-12-06 12:37:57 +01:00
{@type, @depth, @amount} = options
2014-12-06 14:28:58 +01:00
render: (layer, x, y) ->
2014-12-06 12:57:25 +01:00
switch @type
2014-12-06 14:28:58 +01:00
when "stardust" then color = [0, 0, 8, 8]
2014-12-06 14:29:56 +01:00
when "bedrock" then color = [0, 8, 8, 16]
when "lubinit" then color = [0, 16, 8, 24]
when "oxodum" then color = [0, 24, 8, 32]
when "notch" then color = [0, 32, 8, 40]
2014-12-06 14:28:58 +01:00
#layer.fillStyle color
# .fillRect x*8, y*8, 8, 8
layer.drawRegion app.images.layers, color, x*8, y*8
2014-12-06 12:57:25 +01:00
2014-12-06 14:28:58 +01:00
getSpriteForType: (i) ->