app = playground({ width: 8*20*5, height: 8*15*5, scaleToFit: true, smoothing: false, create: -> @loadImages "layers", "active", "selected", "entities" @currentHoveredTile = new Tile ready: -> @game.start() @setState @game step: -> mousedown: (event)-> @posToTile(event.x, event.y).click(event.button) mousemove: (event)-> tile = @posToTile(event.x, event.y) if tile != @currentHoveredTile tile.moveIn() @currentHoveredTile.moveOut() @currentHoveredTile = tile render: -> @layer.clear "#00f" @game.render() posToTile: (x, y)-> pos = (Math.floor(y/8/5)*20) + Math.floor(x/8/5) @game.map[pos] })