This commit is contained in:
2015-03-19 16:08:13 -07:00
23 changed files with 71 additions and 28 deletions

1
desktop/backup.edn Normal file
View File

@@ -0,0 +1 @@
{:active? true, :coaxed-sheep? true, :convinced-wizard? true, :time :day, :inventory (:mandrake :recipe :frog-legs :flask-1 :ladder :trophy), :seen-intro? true, :wizard-left? false, :clues #{}, :hud-active? false, :current-riddle :done, :last-room :outside-house, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:recipe :frog-legs :flask-1 :mandrake :ladder :carrot :trophy}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -22,5 +22,13 @@
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
{:sound-volume 0.0, :music-volume 0.0}
{:sound-volume 56.0, :music-volume 56.0}

View File

@@ -432,6 +432,14 @@
(can-skip? [this screen entities]
false)))
(defn pause-camera [entities]
(update-entities entities #(-> %
(assoc-in [:cam :paused? ] true)
(update-in [:tweens] dissoc :cam-x :cam-y))))
(defn resume-camera [entities]
(update-entities entities #(assoc-in % [:cam :paused? ] false)))
(defn begin-animation [entities target-id anim]
(run-action entities
(begin [this screen entities]

View File

@@ -16,9 +16,9 @@
[com.badlogic.gdx Screen]))
(defn ensure-on-screen [talk]
(let [margin-width (* 0.05 (game :width))
(let [margin-width (* 0.05 1280)
minimum-x margin-width
maximum-x (- (game :width) margin-width)
maximum-x (- 1280 margin-width)
label-width (label! talk :get-width)
label-right (+ (:x talk) label-width)
talk (cond (> label-right maximum-x) (assoc talk :x (- maximum-x label-width))
@@ -63,7 +63,7 @@
[x y] (scene-world->talk-world scene-viewport [source-x
source-y])
talk (assoc (label text style :set-font-scale 1.0 :set-alignment Align/center)
talk (assoc (label text style :set-font-scale scale :set-alignment Align/center)
:source-x source-x :source-y source-y
)
x (- x (/ (label! talk :get-width) 2))

View File

@@ -17,12 +17,14 @@
(defn play-battle [entities anim]
(actions/transition-music entities :fight)
(actions/pause-camera entities)
(actions/add-entity entities :fight (get-in @entities [:room :fight]))
(actions/add-entity entities :hands-fight (get-in @entities [:room :hands-fight]))
(actions/play-animation entities :hands-fight anim)
(actions/transition-music entities nil)
(actions/remove-entity entities :hands-fight)
(actions/remove-entity entities :fight))
(actions/remove-entity entities :fight)
(actions/resume-camera entities))
(defn do-warrior-dialogue [entities]
(actions/walk-to entities :ego [150 45] :face :left)

View File

@@ -142,6 +142,7 @@
(defn pull-sword [entities]
(actions/play-animation entities :ego :reach)
(actions/pause-camera entities)
(actions/transition-music entities :pull-sword)
(actions/add-entity entities :blackout (get-in @entities [:room :blackout]))
(actions/add-entity entities :pull-sword (get-in @entities [:room :pull-sword]))
@@ -151,6 +152,7 @@
(actions/remove-entity entities :pull-sword)
(actions/remove-entity entities :blackout)
(particle-effect! (get-in @entities [:room :entities :magic]) :allow-completion)
(actions/resume-camera entities)
(actions/transition-music entities nil)
(actions/do-dialogue entities :ego "That was weird."
:ego "I have to go show my friends!")

View File

@@ -36,6 +36,13 @@
(actions/has-obtained? entities :money)
(not (actions/has-item? entities :money))))
(defn walk-to-sheep [entities]
(actions/walk-to entities :ego [154 133])
(actions/walk-straight-to entities :ego [119 134] :update-baseline? false))
(defn leave-sheep [entities]
(actions/walk-straight-to entities :ego [154 133] :update-baseline? false))
(defn put-something-in-cauldron [item]
(condp = item
:money (actions/get-script entities
@@ -337,13 +344,13 @@
(if (actions/has-item? entities :wool)
(actions/talk entities :ego "The sheep has given me enough wool.")
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc :face :left)
(do (walk-to-sheep entities)
(actions/play-animation entities :ego :reach)
(actions/give entities :wool)
(actions/talk entities :ego "I guess her wool is shedding."))
(actions/talk entities :ego "I guess her wool is shedding.")
(leave-sheep entities))
(do
(actions/talk entities :ego "Come here mama sheep!")
(actions/glad entities)
(actions/play-animation entities :ego :sigh)
(actions/talk entities :ego "She's too far away for me to pet her.")))))
@@ -351,31 +358,34 @@
:wool (actions/get-script entities
(actions/talk entities :ego "She doesn't need it back."))
:grass (actions/get-script entities
(actions/walk-to entities :ego ego-sheep-loc :face :left)
(walk-to-sheep entities)
(actions/talk entities :ego "Come on girl, get the grass!")
(actions/play-animation entities :ego :reach)
(actions/talk entities :ego "I think she's not interested."))
:carrot (actions/get-script entities
(actions/walk-to entities :ego ego-sheep-loc :face :left)
(walk-to-sheep entities)
(actions/talk entities :ego "Come on girl, get the carrot!")
(actions/walk-straight-to entities :sheep [90 138] :update-baseline? false)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :carrot)
(actions/update-state entities (fn [s] (assoc s :coaxed-sheep? true))))
(actions/update-state entities (fn [s] (assoc s :coaxed-sheep? true)))
(leave-sheep entities))
:flask-1 (actions/get-script entities
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc :face :left)
(actions/play-animation entities :ego :reach)
(do (walk-to-sheep entities)
(actions/play-animation entities :ego :milk)
(actions/remove-item entities :flask-1)
(actions/give entities :flask-1-with-milk)
(actions/talk entities :ego "Sheeps milk."))
(actions/talk entities :ego "Sheeps milk.")
(leave-sheep entities))
(actions/talk entities :ego "She's too far away.")))
:flask-1-with-mushrooms
(actions/get-script entities
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc :face :left)
(actions/play-animation entities :ego :reach)
(items/make-cream-of-mushroom entities))
(do (walk-to-sheep entities)
(actions/play-animation entities :ego :milk)
(items/make-cream-of-mushroom entities)
(leave-sheep entities))
(actions/talk entities :ego "She's too far away.")))
nil)
:left {:walk (utils/flip sheep-walk)

View File

@@ -18,6 +18,7 @@
(def start-y 83)
(defn close [entities]
(screen! @(resolve 'advent.screens.scene/scene) :on-reactivate)
(-> entities
(assoc :shown? false)
@@ -69,6 +70,7 @@
entities))
:show-screen (fn [{:keys [success failure]} [entities]]
(sound! (sound "inside-house/open-safe.ogg") :play (utils/current-sound-volume))
(assoc entities
:start-showing? true
:button-choices []
@@ -103,7 +105,9 @@
(> x (+ start-x 200))
(< y start-y)
(> y (+ start-y 75)))
(close entities))))))
(do
(sound! (sound "inside-house/close-safe.ogg") :play (utils/current-sound-volume))
(close entities)))))))
:on-resize (fn [{:keys [width height viewport]} entities]
(.update viewport width height)))

View File

@@ -198,6 +198,7 @@
scared-walk (utils/make-anim "ego/scared-walk.png" [16 36] 0.05 (range 6))
sigh (utils/make-anim "ego/sigh.png" [18 36] 0.08 [0 0 0 0 1 1 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 0 0 0 0 ])
glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 8 [5 5 5]) (repeat 20 0)]))
milk (utils/make-anim "ego/squat.png" [18 36] 0.05 [0 1 2 2 3 3 3 3 3 3 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 3 3 3 3 3 3 3 3 3 3 3 2 1 0])
ego {:right {:walk walk-right
:stand stand-anim
@@ -233,7 +234,8 @@
:scared-talk scared-talk
:scared-walk scared-walk
:sigh sigh
:glad glad}
:glad glad
:milk milk}
:left {:walk (utils/flip walk-right)
:stand (utils/flip stand-anim)
:talk (utils/flip talk-anim)
@@ -259,12 +261,14 @@
:spear (utils/flip spear)
:pant (utils/flip pant)
:sigh (utils/flip sigh)
:glad (utils/flip glad)}
:glad (utils/flip glad)
:milk (utils/flip milk)}
:baseline (- 240 (last start-pos))
:facing :right
:origin-x 9
:origin-y 0
:scaled true
:milk-sound (sound "outsidehouse/milk.ogg")
:step-sound-1 (sound "ego/step-1.ogg")
:step-sound-2 (sound "ego/step-2.ogg")
:sigh-sound (sound "ego/sigh.ogg")
@@ -338,7 +342,10 @@
143 [:blink 0.15]
176 [:blink 0.15]}
(get-in ego [:left :sigh]) {1 [:sigh-sound 0.4]}
(get-in ego [:right :sigh]) {1 [:sigh-sound 0.4]}}
(get-in ego [:right :sigh]) {1 [:sigh-sound 0.4]}
(get-in ego [:left :milk]) {8 [:milk-sound 1.0]}
(get-in ego [:right :milk]) {8 [:milk-sound 1.0]}
}
:anim-merges {(get-in ego [:right :shock]) {:origin-x 15}
:default {:origin-x 9}})]
(actions/start-animation screen
@@ -534,6 +541,7 @@
entities {:rooms rooms
:step-particles (assoc (particle-effect "ego/step") :x 100 :y 100 :baseline 241)
:cam {:zoom 0.95
:paused? false
:object nil}
:musics {:object nil
:inside-antique (utils/make-music "inside-antique.ogg")
@@ -612,8 +620,9 @@
[id ((:update-fn entity) screen entities entity)]
[id entity])))))
entities (if (and (nil? (get-in entities [:tweens :cam-x]))
(= 1 (rand-int 20)))
entities (if (and (not (get-in entities [:cam :paused?]))
(nil? (get-in entities [:tweens :cam-x]))
(= 1 (rand-int 20)))
(if (= (rand-int 2) 1)
(actions/pan-to screen entities
(get-in entities [:room :entities :ego :x])
@@ -635,12 +644,11 @@
layers (get-layers entities)
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
(when (nil? (:zoom (:cam entities)))
(println entities))
(screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen))
(set! (. camera zoom) (:zoom (:cam entities)))
(set! (.. camera position x) (:x (:cam entities) 160.0))
(set! (.. camera position y) (:y (:cam entities) 120.0))
(when (not (get-in entities [:cam :paused?]))
(set! (. camera zoom) (:zoom (:cam entities)))
(set! (.. camera position x) (:x (:cam entities) 160.0))
(set! (.. camera position y) (:y (:cam entities) 120.0)))
(let [entities (utils/update-override screen entities)]