app = playground({ width: 8*20, height: 8*15, scaleToFit: true, smoothing: false, create: -> @loadImages "layers" @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)*20) + Math.floor(x/8) @game.map[pos] })