(defclass object () ;; whatever the labyrith needs, e.g., position, ... ()) (defclass tablet (object) ()) (defclass super-tablet (tablet) ()) (defclass mobile-object (object) ()) (defclass phantom (mobile-object) ()) (defclass pacman (mobile-object) ((force :initform 0 :accessor pacman-force) (invincible :initform nil :accessor pacman-invincible))) (defgeneric collision (obj1 obj2)) ;;; by default, do nothing (defmethod collision ((obj1 object) (obj2 object)) nil) (defmethod collision ((pac pacman) (tab tablet)) (incf (pacman-force)) (delete-object tab)) (defmethod collision :after ((pac pacman) (tab super-tablet)) (setf (pacman-invincible pac) t)) (defmethod collision ((pac pacman) (phan phantom)) (delete-object (if (pacman-invincible pac) phan pac))) (defmethod collision ((phan phantom) (pac pacman)) (collision pac phan))