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

18 lines
440 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
render: (layer, x, y)->
# TODO: Draw sprite
2014-12-06 12:57:25 +01:00
switch @type
when "grass" then color = "green"
when "mud" then color = "brown"
when "gravel" then color = "lightgrey"
when "stone" then color = "darkgrey"
when "gold" then color = "yellow"
2014-12-06 12:37:57 +01:00
layer.fillStyle color
.fillRect x*8, y*8, 8, 8