This commit is contained in:
Aaron Mueller 2014-12-06 15:09:56 +01:00
parent 2c51828dfd
commit d939e53ce2
2 changed files with 6 additions and 4 deletions

View file

@ -2,7 +2,7 @@ class Tilelayer extends BaseEntity
constructor: (options) ->
{@type, @depth, @amount} = options
@randomFactor = getRandomInt 0, 4
@sprite = [@randomFactor*8, @depth*8, @randomFactor*8+8, @depth*8+8]
@sprite = [@randomFactor*8, @depth*8, 8, 8]
render: (layer, x, y) ->
layer.drawRegion app.images.layers, @sprite, x*8, y*8

View file

@ -1,12 +1,14 @@
app.game =
start: ->
for i in [0..20*15]
for i in [0..20*15-1]
@map[i] = new Tile
render: ->
app.layer.save().scale(3, 3)
app.layer.save().scale(5, 5)
for tile, i in @map
tile.render(i-(Math.floor(i/20)*20), Math.floor(i/20))
y = Math.floor(i/20)
x = i-(y*20)
tile.render(x, y)
app.layer.restore()
@hud.render()