2021-03-07 16:55:50 +00:00
|
|
|
(local dim (require :game.dim))
|
|
|
|
(local util (require :lib.util))
|
|
|
|
|
2021-03-30 23:24:52 +00:00
|
|
|
(local tileset (util.hot-table ...))
|
2021-03-07 16:55:50 +00:00
|
|
|
(fn rect [x y color]
|
|
|
|
(love.graphics.setColor (table.unpack color))
|
|
|
|
(love.graphics.rectangle :fill
|
|
|
|
(- x (/ dim.tilesize 2))
|
|
|
|
(- y (/ dim.tilesize 2))
|
|
|
|
dim.tilesize
|
|
|
|
dim.tilesize))
|
|
|
|
(fn tileset.make-tileset [tiles draw]
|
|
|
|
(each [itile tile (ipairs tiles)]
|
|
|
|
(tset tiles tile.name itile))
|
|
|
|
(set tiles.draw draw)
|
|
|
|
tiles)
|
|
|
|
|
|
|
|
(fn tileset.itile-named [tileset name]
|
|
|
|
(. tileset name))
|
|
|
|
|
|
|
|
(fn tileset.bombertile-draw [tile x y]
|
|
|
|
(match tile.name
|
|
|
|
:strongwall (rect x y [0.7 0.7 0.7])
|
|
|
|
:weakwall (rect x y [0.4 0.4 0.4])
|
|
|
|
:dot (do (love.graphics.setColor 1 1 1)
|
|
|
|
(love.graphics.circle :fill x y (/ dim.tilesize 8)))))
|
|
|
|
|
|
|
|
(set tileset.bombertile (tileset.make-tileset
|
2021-02-07 21:56:19 +00:00
|
|
|
[{:name :empty
|
2021-03-07 16:55:50 +00:00
|
|
|
:empty true}
|
2021-02-07 21:56:19 +00:00
|
|
|
{:name :strongwall
|
2021-04-04 02:36:12 +00:00
|
|
|
:wall true}
|
2021-02-07 21:56:19 +00:00
|
|
|
{:name :weakwall
|
2021-04-04 02:36:12 +00:00
|
|
|
:wall true
|
2021-03-07 16:55:50 +00:00
|
|
|
:breakable true}
|
2021-02-07 21:56:19 +00:00
|
|
|
{:name :dot
|
2021-03-07 16:55:50 +00:00
|
|
|
:edible true}
|
2021-03-30 23:24:52 +00:00
|
|
|
] #(tileset.bombertile-draw $...)))
|
2021-03-07 16:55:50 +00:00
|
|
|
|
2021-03-30 23:24:52 +00:00
|
|
|
tileset.hot
|
2021-03-07 16:55:50 +00:00
|
|
|
|