beginning on inventory screen.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
[advent.zone :as zone]
|
||||
[advent.utils :as utils]
|
||||
[advent.screens.dialogue :refer [talking-screen]]
|
||||
[advent.screens.inventory :refer [inventory-screen]]
|
||||
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!!]])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
@@ -40,21 +41,28 @@
|
||||
(satisfies? ICursorOverridable %))
|
||||
(get-in entities [:background :interactions]))))
|
||||
|
||||
(defn open-inventory [screen entities]
|
||||
(run! inventory-screen :show-screen))
|
||||
|
||||
|
||||
(defn left-click [screen entities]
|
||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})
|
||||
interaction (first (filter #(mouse-in? % [x y])
|
||||
(get-in entities [:background :interactions])))
|
||||
;; TODO - hacky way of resetting queue
|
||||
entities (if-let [current-action (get-in entities [:actions :current])]
|
||||
(assoc (actions/terminate current-action screen entities)
|
||||
:actions {:channel (chan) :current nil :started? false})
|
||||
entities)
|
||||
script (or (when interaction
|
||||
(get-script interaction [x y]))
|
||||
(get-script default-interaction [x y]))]
|
||||
|
||||
(script entities)
|
||||
entities))
|
||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
||||
(if ((:mouse-in? (:inventory entities)) x y)
|
||||
(open-inventory screen entities)
|
||||
|
||||
(let [interaction (first (filter #(mouse-in? % [x y])
|
||||
(get-in entities [:background :interactions])))
|
||||
;; TODO - hacky way of resetting queue
|
||||
entities (if-let [current-action (get-in entities [:actions :current])]
|
||||
(assoc (actions/terminate current-action screen entities)
|
||||
:actions {:channel (chan) :current nil :started? false})
|
||||
entities)
|
||||
script (or (when interaction
|
||||
(get-script interaction [x y]))
|
||||
(get-script default-interaction [x y]))]
|
||||
|
||||
(script entities)
|
||||
entities))))
|
||||
|
||||
(defn flip [anim]
|
||||
(animation (animation! anim :get-frame-duration)
|
||||
@@ -242,7 +250,7 @@
|
||||
:cursor :down}}
|
||||
:layers [(assoc (texture "cat-tree/background.png") :x 0 :y 0 :baseline 0)
|
||||
(assoc (texture "cat-tree/tree-and-rock.png") :x 0 :y 0 :baseline 161)
|
||||
(assoc (texture "cat-tree/sillhoute.png") :x 0 :y 0 :baseline 9000)]
|
||||
(assoc (texture "cat-tree/sillhoute.png") :x 0 :y 0 :baseline 240)]
|
||||
:entities {}
|
||||
:collision "cat-tree/collision.png"
|
||||
:scale-fn (scaler-fn-with-baseline 110 0.10 1.20))
|
||||
@@ -302,6 +310,8 @@
|
||||
:override nil}
|
||||
:background (assoc-in (:outside-house backgrounds)
|
||||
[:entities :ego] (get-ego screen))
|
||||
:inventory (assoc (texture "inventory.png") :x 278 :y 0 :baseline 9000
|
||||
:mouse-in? (zone/box 278 0 320 42))
|
||||
:fps (assoc (label "0" (color :white) ) :x 5 :baseline 9000)}))
|
||||
|
||||
:on-render
|
||||
|
||||
Reference in New Issue
Block a user