edtris/game/tiles.fnl

28 lines
801 B
Plaintext
Raw Normal View History

(local dim (require :game.dim))
(local util (require :lib.util))
2021-04-11 03:39:42 +00:00
(local {: defmethod} (util.require :lib.multimethod))
(local {: drawtile} (util.require :game.tilemap))
(local tileset (util.hot-table ...))
(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))
2022-04-24 23:39:15 +00:00
(defmethod drawtile :wall (fn [tile x y] (rect x y [0.7 0.7 0.7])))
(defmethod drawtile :block (fn [tile x y] (rect x y [0.4 0.4 0.4])))
2022-04-24 23:39:15 +00:00
(set tileset.tetristile
{" " {:name :empty
:empty true}
"X" {:name :wall
:wall true}
"#" {:name :block
:wall true}})
tileset.hot