making cat toys.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -91,7 +91,7 @@
|
|||||||
(if highlighted-item
|
(if highlighted-item
|
||||||
(if (= :main current-cursor)
|
(if (= :main current-cursor)
|
||||||
(run! @(resolve 'advent.screens.scene/scene) :on-chose-item :item highlighted-item)
|
(run! @(resolve 'advent.screens.scene/scene) :on-chose-item :item highlighted-item)
|
||||||
(when-let [interaction-script ((or (:scripts highlighted-item) (constantly nil)) current-cursor)]
|
(when-let [interaction-script ((or (:scripts highlighted-item) (constantly nil)) (:value current-cursor))]
|
||||||
(interaction-script room-entities)
|
(interaction-script room-entities)
|
||||||
(close entities)))
|
(close entities)))
|
||||||
(close entities)))))
|
(close entities)))))
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
(ns advent.screens.items
|
(ns advent.screens.items
|
||||||
(:require [advent.actions :as actions]))
|
(:require [advent.actions :as actions]))
|
||||||
|
|
||||||
(def wool {:name "Wool" :value :wool :cursor :wool})
|
|
||||||
|
(declare stick)
|
||||||
|
(declare wool)
|
||||||
|
(declare cat-toy)
|
||||||
|
(def make-cat-toy
|
||||||
|
(actions/get-script entities
|
||||||
|
(actions/remove-item entities stick)
|
||||||
|
(actions/remove-item entities wool)
|
||||||
|
(actions/give entities cat-toy)
|
||||||
|
(actions/talk entities :ego "It makes a little cat toy!")))
|
||||||
|
|
||||||
|
(def wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}})
|
||||||
(def mushrooms {:name "Mushrooms" :value :mushrooms :cursor :mushrooms})
|
(def mushrooms {:name "Mushrooms" :value :mushrooms :cursor :mushrooms})
|
||||||
(def carrot {:name "Carrot" :value :carrot :cursor :carrot})
|
(def carrot {:name "Carrot" :value :carrot :cursor :carrot})
|
||||||
|
|
||||||
@@ -16,15 +27,19 @@
|
|||||||
(actions/talk entities :ego "It's just like cream of mushroom soup.")))
|
(actions/talk entities :ego "It's just like cream of mushroom soup.")))
|
||||||
|
|
||||||
(def flask-1-with-milk {:name "Flask with milk" :value :flask-1-with-milk :cursor :flask-with-contents
|
(def flask-1-with-milk {:name "Flask with milk" :value :flask-1-with-milk :cursor :flask-with-contents
|
||||||
:scripts {mushrooms (make-cream-of-mushroom-from flask-1-with-milk)}})
|
:scripts {:mushrooms (make-cream-of-mushroom-from flask-1-with-milk)}})
|
||||||
|
|
||||||
(def flask-1-strength {:name "Strength potion" :value :flask-1-strength :cursor :flask-with-contents})
|
(def flask-1-strength {:name "Strength potion" :value :flask-1-strength :cursor :flask-with-contents})
|
||||||
(def flask-1 {:name "Flask" :value :flask-1 :cursor :flask
|
(def flask-1 {:name "Flask" :value :flask-1 :cursor :flask
|
||||||
:scripts {mushrooms (actions/get-script entities
|
:scripts {:mushrooms (actions/get-script entities
|
||||||
(actions/remove-item entities flask-1)
|
(actions/remove-item entities flask-1)
|
||||||
(actions/give entities flask-1-with-mushrooms)
|
(actions/give entities flask-1-with-mushrooms)
|
||||||
(actions/talk entities :ego "I'll just put a few of these in here."))}})
|
(actions/talk entities :ego "I'll just put a few of these in here."))}})
|
||||||
|
|
||||||
(def cards {:name "Warlock's Tower cards" :value :cards :cursor :cards})
|
(def cards {:name "Warlock's Tower cards" :value :cards :cursor :cards})
|
||||||
(def cheat-deck {:name "Warlock's Tower cheat deck" :value :cheat-deck :cursor :cheat-deck})
|
(def cheat-deck {:name "Warlock's Tower cheat deck" :value :cheat-deck :cursor :cheat-deck})
|
||||||
(def stick {:name "Stick" :value :stick :cursor :stick})
|
|
||||||
|
(def cat-toy {:name "Cat toy" :value :cat-toy :cursor :cat-toy})
|
||||||
|
(def stick {:name "Stick" :value :stick :cursor :stick :scripts {:wool make-cat-toy}})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
(if (= :main cursor)
|
(if (= :main cursor)
|
||||||
(:script spec)
|
(:script spec)
|
||||||
(when-let [scripts (:scripts spec)]
|
(when-let [scripts (:scripts spec)]
|
||||||
(scripts cursor))))}))
|
(scripts (:value cursor)))))}))
|
||||||
entities (into {} (for [[id entity] entities]
|
entities (into {} (for [[id entity] entities]
|
||||||
[id (merge entity
|
[id (merge entity
|
||||||
{:mouse-in? (fn [entities x y]
|
{:mouse-in? (fn [entities x y]
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
(if (= :main cursor)
|
(if (= :main cursor)
|
||||||
(:script entity)
|
(:script entity)
|
||||||
(when-let [scripts (:scripts entity)]
|
(when-let [scripts (:scripts entity)]
|
||||||
(scripts cursor))))}))]))]
|
(scripts (:value cursor)))))}))]))]
|
||||||
(merge params {:collision (advent.pathfind/map-from-resource collision)
|
(merge params {:collision (advent.pathfind/map-from-resource collision)
|
||||||
:interactions interactions-as-list
|
:interactions interactions-as-list
|
||||||
:entities entities})))
|
:entities entities})))
|
||||||
|
|||||||
@@ -173,13 +173,13 @@
|
|||||||
(actions/give entities items/wool)
|
(actions/give entities items/wool)
|
||||||
(actions/talk entities :ego "I guess her wool is shedding."))
|
(actions/talk entities :ego "I guess her wool is shedding."))
|
||||||
(actions/talk entities :ego "She's too far away for me to pet her."))))
|
(actions/talk entities :ego "She's too far away for me to pet her."))))
|
||||||
:scripts {items/wool (actions/get-script entities
|
:scripts {:wool (actions/get-script entities
|
||||||
(actions/talk entities :ego "She doesn't need it back."))
|
(actions/talk entities :ego "She doesn't need it back."))
|
||||||
items/carrot (actions/get-script entities
|
:carrot (actions/get-script entities
|
||||||
(actions/walk-to entities :ego ego-sheep-loc)
|
(actions/walk-to entities :ego ego-sheep-loc)
|
||||||
(actions/talk entities :ego "Come on girl, get the carrot!")
|
(actions/talk entities :ego "Come on girl, get the carrot!")
|
||||||
(actions/walk-straight-to entities :sheep [95 150]))
|
(actions/walk-straight-to entities :sheep [95 150]))
|
||||||
items/flask-1 (actions/get-script entities
|
:flask-1 (actions/get-script entities
|
||||||
(if (is-sheep-close? @entities)
|
(if (is-sheep-close? @entities)
|
||||||
(do (actions/walk-to entities :ego ego-sheep-loc)
|
(do (actions/walk-to entities :ego ego-sheep-loc)
|
||||||
(actions/play-animation entities :ego :reach)
|
(actions/play-animation entities :ego :reach)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
||||||
(println (:input-x screen) (:input-y screen) "->" x y)))
|
(println (:input-x screen) (:input-y screen) "->" x y)))
|
||||||
|
|
||||||
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :cards :cheat-deck :stick])
|
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :cards :cheat-deck :stick :cat-toy])
|
||||||
|
|
||||||
(defn cursor [filename which]
|
(defn cursor [filename which]
|
||||||
(let [scale 2
|
(let [scale 2
|
||||||
|
|||||||
Reference in New Issue
Block a user