Describing Objects at a Specific Location
To create the final piece of code to help us visualize our game world, we need to describe the objects on the floor at a given location, which a player can pick up and use.
Listing Visible Objects
To do so, we first create a list of the objects:
> (defparameter *objects* '(whiskey bucket frog chain))
*OBJECTS*
We can also create a second variable, *object-locations*
, to track the location of each object in the form of an alist:
(defparameter *object-locations* '((whiskey living-room) (bucket living-room) (chain garden) (frog garden)))
Next, we write a function that lists the objects visible from a given location: ...
Get Land of Lisp now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.