Invisible and/or weird interactible entities! =w=

This commit is contained in:
Jaidyn Ann 2023-06-25 19:59:34 -05:00
parent 67019e9afb
commit 9ee7597772
2 changed files with 16 additions and 2 deletions

View File

@ -235,8 +235,21 @@ alist containing a character (:CHAR) and :X & :Y coordinates."
(defun matrix-write-entity (matrix entity-plist) (defun matrix-write-entity (matrix entity-plist)
"Render an entity-plist to the matrix." "Render an entity-plist to the matrix."
(when (getf entity-plist :face)
(matrix-write-entity-head matrix entity-plist) (matrix-write-entity-head matrix entity-plist)
(matrix-write-entity-legs matrix entity-plist)) (matrix-write-entity-legs matrix entity-plist))
(when (getf entity-plist :avatar)
(matrix-write-entity-avatar matrix entity-plist)))
(defun matrix-write-entity-avatar (matrix entity-plist)
"Draw an “avatar” entity; that is, not a person, but a random item."
(let* ((screen-coords (world-coords->screen-coords (getf entity-plist :coords)))
(avatar (getf entity-plist :avatar))
(width (length avatar))
(y (getf screen-coords :y))
(x (- (getf screen-coords :x) (floor (/ width 2)))))
(📋:render-line matrix avatar x y)))
(defun matrix-write-entity-head (matrix entity-plist) (defun matrix-write-entity-head (matrix entity-plist)

View File

@ -71,6 +71,7 @@ character-scale world coordinates in plist form."
:face (gethash "normal_face" properties) :face (gethash "normal_face" properties)
:normal-face (gethash "normal_face" properties) :normal-face (gethash "normal_face" properties)
:talking-face (gethash "talking_face" properties) :talking-face (gethash "talking_face" properties)
:avatar (gethash "avatar" properties)
:interact (gethash "interact" properties) :interact (gethash "interact" properties)
:direction (if (gethash "facing_right" properties) :direction (if (gethash "facing_right" properties)
'right 'right