2021-03-07 16:55:50 +00:00
|
|
|
(local dim (require :game.dim))
|
|
|
|
(local util (require :lib.util))
|
|
|
|
|
|
|
|
(local tileset {})
|
|
|
|
(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-03-28 19:23:08 +00:00
|
|
|
:solid true}
|
2021-02-07 21:56:19 +00:00
|
|
|
{:name :weakwall
|
2021-03-28 19:23:08 +00:00
|
|
|
:solid 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-28 19:23:08 +00:00
|
|
|
] (util.fn tileset :bombertile-draw)))
|
2021-03-07 16:55:50 +00:00
|
|
|
|
|
|
|
tileset
|
|
|
|
|