summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets.lisp11
-rw-r--r--assets/backdrop.pngbin0 -> 201852 bytes
-rw-r--r--assets/sliding-door.pngbin0 -> 10627 bytes
-rw-r--r--the-price-of-a-cup-of-coffee.lisp31
4 files changed, 35 insertions, 7 deletions
diff --git a/assets.lisp b/assets.lisp
index 3a30a35..0d38f7e 100644
--- a/assets.lisp
+++ b/assets.lisp
@@ -98,11 +98,16 @@
(defparameter +things-look-up-track-path+ #P"assets/thingslookup.mp3")
(defparameter +cold-day-track-path+ #P"assets/coldday.mp3")
(defparameter +emoji-sheet-image+ #P"assets/emoji.png")
+(defparameter +sliding-door-image+ #P"assets/sliding-door.png")
+(defparameter +backdrop-image+ #P"assets/backdrop.png")
(defvar *nance-texture*)
(defvar *suit-texture*)
(defvar *normy-texture*)
(defvar *expression-texture*)
+(defvar *backdrop-texture*)
+(defvar *sliding-door-texture*)
+(defvar *sliding-door-position* (sdl2:make-rect 800 8 104 138))
(defvar *harmony-initialized-p* nil)
(defvar *cold-day-track*)
@@ -122,6 +127,12 @@
(with-surface-from-file (surf +emoji-sheet-image+)
(setf *expression-texture* (sdl2:create-texture-from-surface renderer surf)))
+ (with-surface-from-file (surf +sliding-door-image+)
+ (setf *sliding-door-texture* (sdl2:create-texture-from-surface renderer surf)))
+
+ (with-surface-from-file (surf +backdrop-image+)
+ (setf *backdrop-texture* (sdl2:create-texture-from-surface renderer surf)))
+
(unless *harmony-initialized-p*
(harmony-simple:initialize)
(setf *looking-up-track* (harmony-simple:play +things-look-up-track-path+ :music :loop t))
diff --git a/assets/backdrop.png b/assets/backdrop.png
new file mode 100644
index 0000000..5cddb8d
--- /dev/null
+++ b/assets/backdrop.png
Binary files differ
diff --git a/assets/sliding-door.png b/assets/sliding-door.png
new file mode 100644
index 0000000..f38fbcb
--- /dev/null
+++ b/assets/sliding-door.png
Binary files differ
diff --git a/the-price-of-a-cup-of-coffee.lisp b/the-price-of-a-cup-of-coffee.lisp
index f70161a..2038c18 100644
--- a/the-price-of-a-cup-of-coffee.lisp
+++ b/the-price-of-a-cup-of-coffee.lisp
@@ -5,8 +5,8 @@
(defparameter +window-width+ 1024)
(defparameter +window-height+ 600)
(defparameter +meter-bar-height+ 16)
-(defparameter +vert-min+ 16)
-(defparameter +vert-max+ (- +window-height+ 128 10))
+(defparameter +vert-min+ 24)
+(defparameter +vert-max+ (- +window-height+ 128 30))
(defparameter +frame-delay+ (round (/ 1000 60)))
(defvar *nance*)
@@ -91,6 +91,7 @@
(defvar *cold-meter*
(make-instance 'status-meter
:color (list 0 140 240 200)
+ :decoration "cold"
:filled-shape (sdl2:make-rect (+ padding (* 4 measure)) padding 1 +meter-bar-height+)
:shape (sdl2:make-rect (+ padding (* 4 measure)) padding width +meter-bar-height+)
:percent 0.0
@@ -216,13 +217,11 @@
(setf (sick-p hero) nil)
(setf (walk-speed hero) (* 2 (walk-speed hero)))))
-
(defmethod update :after ((hero hero) ticks)
(with-slots (pos) hero
(setf (sdl2:rect-x pos)
(mod (sdl2:rect-x pos) +window-width+))))
-
(def-normal-class pedestrian (human)
(comfort-rad 60)
(react-per-sec 4)
@@ -268,8 +267,6 @@
suit))
-
-
(defun boot-up (renderer)
;; cleanup from previous calls to start - used while testing
(setf *pedestrians* nil)
@@ -289,8 +286,23 @@
(push (car *pedestrians*) *to-render-by-y*))
+(defun stop-and-consider (pedestrian))
+ ;; (with-slots (walk-vec expression anger kindness generosity vulnerability) pedestrian
+ ;; (incf (percent *stress-meter*) vulnerability)
+ ;; (let ((old-vec (copy-list walk-vec)))
+ ;; (setf (car walk-vec) 0)
+ ;; (setf (cdr walk-vec) 0)
+ ;; (cond
+ ;; ((cointoss anger) (emote pedestrian "angry")
+
(defun action-key-pressed ()
- (print "Action"))
+ (let-if (mark (find-if (lambda (ped)
+ (< (dist ped *nance*)
+ (* 0.5 (comfort-rad ped))))
+ *pedestrians*))
+ (stop-and-consider mark)
+ (incf (percent *stress-meter*) 0.01)))
+
(defun any-p (arg &rest preds)
(and preds
@@ -430,6 +442,7 @@
(defun handle-keyup (keysym)
(let ((key (sdl2:scancode-value keysym)))
(match-key key
+ (:scancode-space (setf (keys-down-action *keys-down*) nil))
(:scancode-left (setf (keys-down-left *keys-down*) nil)
(rem-walk-hero-left))
@@ -515,6 +528,10 @@
(sdl2:set-render-draw-color renderer 80 80 80 255)
(sdl2:render-clear renderer)
+ (sdl2:render-copy renderer *backdrop-texture*)
+ (sdl2:render-copy renderer *sliding-door-texture*
+ :dest-rect *sliding-door-position*)
+
;; render characters and other objects
(setf *to-render-by-y*
(sort *to-render-by-y* #'< :key #'y-pos))