outsidehouse
This commit is contained in:
@@ -55,8 +55,6 @@
|
||||
(fn [screen entities {:keys [create-talk target-id color text x y scale scene-viewport id]}]
|
||||
(let [font (doto (bitmap-font "ego/font.fnt" )
|
||||
(bitmap-font! :set-use-integer-positions false))
|
||||
p (NinePatchEntity. (skin! (skin "ui/ui.json") :get-patch "ui-bg"))
|
||||
_ (nine-patch! p :set-padding 25 25 5 15)
|
||||
|
||||
tr (bitmap-font! font :get-region)
|
||||
scale (* scale (/ utils/ui-scale 2))
|
||||
@@ -241,8 +239,6 @@
|
||||
:on-toast
|
||||
(fn [screen entities {:keys [message]}]
|
||||
(let [font (bitmap-font "ego/font.fnt" )
|
||||
p (nine-patch {:region (:object (utils/get-texture "talk-bg-2.png")) :left 9 :top 9 :right 9 :bottom 9})
|
||||
_ (nine-patch! p :set-padding 25 25 5 15)
|
||||
|
||||
tr (bitmap-font! font :get-region)
|
||||
|
||||
|
||||
@@ -18,16 +18,17 @@
|
||||
(defscreen fade-screen
|
||||
:on-show
|
||||
(fn [screen entities options]
|
||||
(utils/setup-viewport screen 320 240)
|
||||
|
||||
{:fade (assoc (utils/get-texture "black.png")
|
||||
:scale-x 100
|
||||
:scale-y 100
|
||||
:x -1
|
||||
:y -1
|
||||
:opacity 1.0
|
||||
:origin-x 0
|
||||
:origin-y 0)})
|
||||
(let [[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")]
|
||||
(utils/setup-viewport screen 320 240)
|
||||
|
||||
{:fade (assoc (utils/atlas->texture global-atlas "black.png")
|
||||
:scale-x 100
|
||||
:scale-y 100
|
||||
:x -1
|
||||
:y -1
|
||||
:opacity 1.0
|
||||
:origin-x 0
|
||||
:origin-y 0)}))
|
||||
|
||||
|
||||
:on-render
|
||||
@@ -35,6 +36,10 @@
|
||||
(render! screen [(:fade entities)])
|
||||
entities)
|
||||
|
||||
:on-hide
|
||||
(fn [screen entities options]
|
||||
(utils/release-resources screen))
|
||||
|
||||
:update-fade (fn [_ entities {:keys [opacity]}]
|
||||
(assoc-in entities [:fade :opacity] opacity))
|
||||
|
||||
|
||||
@@ -114,12 +114,13 @@
|
||||
(defscreen inventory-screen
|
||||
:on-show
|
||||
(fn [screen entities options]
|
||||
(let [screen (utils/setup-viewport screen 1280 960)
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
screen (utils/setup-viewport screen 1280 960)
|
||||
hovered-text (assoc (label "" (style :label (utils/get-font "ego/font.fnt") (color :white)) :set-font-scale 0.25) :x 0 :y 850 :width 1280 )]
|
||||
(label! hovered-text :set-alignment Align/bottom)
|
||||
(utils/add-actor-to-stage screen hovered-text)
|
||||
{:overlay (assoc (utils/get-texture "inventory-overlay.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0 :opacity 0.0)
|
||||
:fade (assoc (utils/get-texture "black.png")
|
||||
{:overlay (assoc (utils/atlas->texture atlas "inventory-overlay" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0 :opacity 0.0)
|
||||
:fade (assoc (utils/atlas->texture atlas "black.png")
|
||||
:scale-x 80
|
||||
:scale-y 80
|
||||
:opacity 0.7
|
||||
@@ -204,4 +205,7 @@
|
||||
(right-click screen entities options))))
|
||||
|
||||
:on-resize (fn [{:keys [^FitViewport viewport] :as screen} entities {:keys [width height]}]
|
||||
(.update viewport width height true)))
|
||||
(.update viewport width height true))
|
||||
:on-hide (fn [screen entities options]
|
||||
(utils/release-resources screen)))
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
:time time)
|
||||
(actions/play-animation entities :ego :standup))
|
||||
|
||||
(defn make-wizard [screen wizard-spec]
|
||||
(let [wizard-sheet (texture! (utils/get-texture "wizard/talk.png") :split 20 46)
|
||||
(defn make-wizard [screen atlas wizard-spec]
|
||||
(let [wizard-sheet (texture! (utils/atlas->texture atlas "wizard/talk") :split 20 46)
|
||||
wizard-stand (animation 0.2 (for [i (flatten [(repeat 10 0) 1])]
|
||||
(aget wizard-sheet 0 i)))
|
||||
wizard-talk-angry (utils/make-anim "wizard/talk-angry.png" [20 50] 0.2 [0 2 0 2 1 2 0 3 0 2 0 1 0 2])
|
||||
wizard-magic-hands (utils/make-anim "wizard/magic-hands.png" [20 50] 0.2 (range 2))
|
||||
wizard-disappear (utils/make-anim "wizard/disappear.png" [20 46] 0.075 (range 19))
|
||||
wizard-talk-angry (utils/make-anim atlas "wizard/talk-angry" [20 50] 0.2 [0 2 0 2 1 2 0 3 0 2 0 1 0 2])
|
||||
wizard-magic-hands (utils/make-anim atlas "wizard/magic-hands" [20 50] 0.2 (range 2))
|
||||
wizard-disappear (utils/make-anim atlas "wizard/disappear" [20 46] 0.075 (range 19))
|
||||
disappear-left (utils/flip wizard-disappear)
|
||||
wizard-talk (animation 0.2 (for [i [0 2 0 2 1 2 0 3 0 2 0 1 0 2]]
|
||||
(aget wizard-sheet 0 i)))
|
||||
|
||||
@@ -604,6 +604,7 @@
|
||||
|
||||
(defn make [screen]
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/outsidehouse.atlas")
|
||||
[screen global-atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
sheep-stand-sheet (texture! (utils/atlas->texture atlas "sheep-anim") :split 33 21)
|
||||
sheep-walk-sheet (texture! (utils/atlas->texture atlas "sheep-walk") :split 33 21)
|
||||
lamb-walk-sheet (texture! (utils/atlas->texture atlas "lamb-walk") :split 27 28)
|
||||
@@ -615,7 +616,7 @@
|
||||
door (utils/make-anim atlas "door" [24 58] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
|
||||
sheep-walk (animation 0.05 (for [i (range 6)]
|
||||
(aget sheep-walk-sheet 0 i)))
|
||||
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
|
||||
butterfly-stand (utils/make-anim atlas "butterfly" [7 7] 0.1 [0 1])
|
||||
cauldron (utils/make-anim atlas "cauldron" [50 38] 0.15 (range 4))
|
||||
charcoal (utils/make-anim-seq atlas "charcoal" [24 18] 0.25 (range 4))
|
||||
scaler (utils/scaler-fn-with-baseline 110 0.10 1.00)
|
||||
@@ -677,20 +678,20 @@
|
||||
entities
|
||||
(walk-to-castle entities))
|
||||
:cursor :left}}
|
||||
:layers {:day [(assoc (utils/get-texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/get-texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/get-texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
|
||||
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/atlas->texture atlas "fence") :x 0 :y 0 :baseline 93)
|
||||
|
||||
(assoc (utils/get-texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
|
||||
(assoc (utils/get-texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
|
||||
(assoc (utils/get-texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]
|
||||
:night [(assoc (utils/get-texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/get-texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/get-texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
|
||||
(assoc (utils/atlas->texture atlas "background-trees") :x 0 :y 0 :baseline 44)
|
||||
(assoc (utils/atlas->texture atlas "fg1") :x 0 :y 0 :baseline 1000 :parallax 1.5)
|
||||
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]
|
||||
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
|
||||
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
|
||||
(assoc (utils/atlas->texture atlas "fence") :x 0 :y 0 :baseline 93)
|
||||
|
||||
(assoc (utils/get-texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
|
||||
(assoc (utils/get-texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
|
||||
(assoc (utils/get-texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]}
|
||||
(assoc (utils/atlas->texture atlas "background-trees") :x 0 :y 0 :baseline 44)
|
||||
(assoc (utils/atlas->texture atlas "fg1") :x 0 :y 0 :baseline 1000 :parallax 1.5)
|
||||
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]}
|
||||
:entities {:sheep (actions/start-animation screen
|
||||
(assoc (animation->texture screen sheep-stand) :x 38 :y 160 :baseline 80
|
||||
[:stand 1] sheep-1
|
||||
@@ -796,7 +797,7 @@
|
||||
:door-sound (utils/load-sound "door.ogg")
|
||||
:anim-sound-frames {door {1 [:door-sound 0.1]}}
|
||||
)
|
||||
:lamb (assoc (utils/get-texture "outsidehouse/lamb.png")
|
||||
:lamb (assoc (utils/atlas->texture atlas "lamb")
|
||||
:cursor :look
|
||||
:label "Baby lamb"
|
||||
:x 10 :y 163 :baseline 77
|
||||
@@ -853,13 +854,13 @@
|
||||
(actions/talk entities :ego "It's a small, sharp piece of charcoal.")
|
||||
)
|
||||
))
|
||||
:wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
|
||||
:wizard (rooms/make-entity :wizard (common/make-wizard screen global-atlas {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
|
||||
:script (actions/get-script entities (talk-to-gandarf-outside entities))
|
||||
:scripts {:default (actions/get-script entities (actions/talk entities :wizard "No time for that!"))
|
||||
:sword (actions/get-script entities (actions/do-dialogue entities
|
||||
:wizard "The Sword of Blergh!"
|
||||
:wizard "Good job, Tick."))}}))
|
||||
:note (rooms/make-entity :note (assoc (utils/get-texture "outsidehouse/note.png")
|
||||
:note (rooms/make-entity :note (assoc (utils/atlas->texture atlas "note")
|
||||
:x 277 :y 74 :baseline 160
|
||||
:label "Paper airplane"
|
||||
:cursor :hand
|
||||
|
||||
@@ -44,14 +44,15 @@
|
||||
(fn [screen entities options]
|
||||
(utils/setup-viewport screen 320 240)
|
||||
|
||||
(let [inputed-key (utils/get-texture "inside-house/inputed-key.png")]
|
||||
{:fade (assoc (utils/get-texture "black.png")
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/global.atlas")
|
||||
inputed-key (utils/atlas->texture atlas "safe/inputed-key.png")]
|
||||
{:fade (assoc (utils/atlas->texture atlas "black.png")
|
||||
:scale-x 80
|
||||
:scale-y 80
|
||||
:opacity 0.7
|
||||
:origin-x 0
|
||||
:origin-y 0)
|
||||
:safe (assoc (utils/get-texture "inside-house/safe-screen.png") :x start-x :y start-y)
|
||||
:safe (assoc (utils/atlas->texture atlas "safe/safe-screen") :x start-x :y start-y)
|
||||
:entered-keys (doall (for [i (range 5)]
|
||||
(assoc inputed-key
|
||||
:x (+ start-x 12 (* i 12))
|
||||
|
||||
@@ -1266,7 +1266,7 @@
|
||||
:object nil}
|
||||
:fade {:object nil
|
||||
:opacity 0.0}
|
||||
:white-fade (assoc (utils/get-texture "white.png")
|
||||
:white-fade (assoc (utils/atlas->texture global-atlas "white")
|
||||
:scale-x 30
|
||||
:scale-y 30
|
||||
:baseline 9500
|
||||
@@ -1882,13 +1882,13 @@
|
||||
:width 42 :height 56
|
||||
:origin-x 21 :origin-y 27
|
||||
:scale-x utils/ui-scale :scale-y utils/ui-scale
|
||||
:open (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
|
||||
:open (utils/flip (doto (utils/make-anim-seq global-atlas "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
|
||||
(animation! :set-play-mode (play-mode :normal))))
|
||||
:anim (utils/flip (utils/make-anim global-atlas "inventory" [42 56] 0.1 [0]))
|
||||
:anim-loop? false
|
||||
:default (utils/flip (utils/make-anim global-atlas "inventory" [42 56] 0.1 [0]))
|
||||
:opened (utils/flip (utils/make-anim-seq "open-inventory" [42 56] 0.1 [7]))
|
||||
:closing (utils/flip (doto (utils/make-anim-seq "open-inventory" [42 56] 0.055 [7 7 7 7 7 7 7 9 10 11 12 0])
|
||||
:opened (utils/flip (utils/make-anim-seq global-atlas "open-inventory" [42 56] 0.1 [7]))
|
||||
:closing (utils/flip (doto (utils/make-anim-seq global-atlas "open-inventory" [42 56] 0.055 [7 7 7 7 7 7 7 9 10 11 12 0])
|
||||
(animation! :set-play-mode (play-mode :normal))))
|
||||
:anim-start 0
|
||||
:opacity 0.8)
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
|
||||
(defn get-texture
|
||||
([path]
|
||||
(println "WARNING: using pack.atlas:" path)
|
||||
(get-texture "packed/pack.atlas" path))
|
||||
([atlas path]
|
||||
(atlas->texture (texture-atlas atlas) path))
|
||||
|
||||
Reference in New Issue
Block a user