diff --git a/overworld.lisp b/overworld.lisp index 4ebf250..7eb6db4 100644 --- a/overworld.lisp +++ b/overworld.lisp @@ -235,8 +235,21 @@ alist containing a character (:CHAR) and :X & :Y coordinates." (defun matrix-write-entity (matrix entity-plist) "Render an entity-plist to the matrix." - (matrix-write-entity-head matrix entity-plist) - (matrix-write-entity-legs matrix entity-plist)) + (when (getf entity-plist :face) + (matrix-write-entity-head 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) diff --git a/overworld.tiled.lisp b/overworld.tiled.lisp index c5c9dc2..31910b1 100644 --- a/overworld.tiled.lisp +++ b/overworld.tiled.lisp @@ -71,6 +71,7 @@ character-scale world coordinates in plist form." :face (gethash "normal_face" properties) :normal-face (gethash "normal_face" properties) :talking-face (gethash "talking_face" properties) + :avatar (gethash "avatar" properties) :interact (gethash "interact" properties) :direction (if (gethash "facing_right" properties) 'right