diff options
author | Boutade <thegoofist@protonmail.com> | 2019-10-18 18:19:54 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-10-18 18:19:54 -0500 |
commit | 0538cbdfb2dfe899cabd706d1681798e60946b69 (patch) | |
tree | b5fdbc452e7a8865e34997bd193055cbb2a870e4 /the-price-of-a-cup-of-coffee.lisp | |
parent | 55969641b27d4419d6b70f2244ca0a2afd5f69e5 (diff) |
detecting coffee break init
Diffstat (limited to 'the-price-of-a-cup-of-coffee.lisp')
-rw-r--r-- | the-price-of-a-cup-of-coffee.lisp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/the-price-of-a-cup-of-coffee.lisp b/the-price-of-a-cup-of-coffee.lisp index b73e191..90f112d 100644 --- a/the-price-of-a-cup-of-coffee.lisp +++ b/the-price-of-a-cup-of-coffee.lisp @@ -226,7 +226,7 @@ (sick-p nil)) -(defvar *sickness-rect* (sdl2:make-rect 0 0 32 32)) +(defvar *sickness-rect* (sdl2:make-rect 0 0 40 40)) (defmethod render :after ((nance hero) renderer) (when (sick-p nance) @@ -418,13 +418,35 @@ (cdr vec)))) (push pause *tweens*))) +(defun enough-for-coffee-p () + (<= 0.45 (percent *money-meter*))) + +(defun enough-for-food-p () + (<= 1.0 (percent *money-meter*))) + +(defun get-coffee! () + (print "Getting Coffee!!!")) + +(defun get-food! () + (print "Getting Food!!!")) + (defun action-key-pressed () - (let-if (mark (find-if (lambda (ped) - (and (not (already-asked ped)) - (< (dist ped *nance*) - (* 0.75 (comfort-rad ped))))) - *pedestrians*)) - (stop-and-consider mark))) + (cond + ((and (in-front-of-door-p) + (eql 'facing-up (face *nance*)) + (enough-for-coffee-p)) + (get-coffee!)) + ((and (in-front-of-door-p) + (eql 'facing-up (face *nance*)) + (enough-for-food-p)) + (get-food!)) + (t + (let-when (mark (find-if (lambda (ped) + (and (not (already-asked ped)) + (< (dist ped *nance*) + (* 0.75 (comfort-rad ped))))) + *pedestrians*)) + (stop-and-consider mark))))) |