Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jonas1989 2014-12-06 15:12:47 +01:00
commit 29902aa10a
2 changed files with 6 additions and 4 deletions

View file

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

View file

@ -1,12 +1,14 @@
app.game = app.game =
start: -> start: ->
for i in [0..20*15] for i in [0..20*15-1]
@map[i] = new Tile @map[i] = new Tile
render: -> render: ->
app.layer.save().scale(3, 3) app.layer.save().scale(5, 5)
for tile, i in @map 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() app.layer.restore()
@hud.render() @hud.render()