refinement on closing.

This commit is contained in:
2014-12-23 15:44:36 -08:00
parent 3d41cb2cf9
commit 5a83a4a17d
32 changed files with 103 additions and 19 deletions

View File

@@ -241,7 +241,7 @@
(defn get-text-duration [text]
(* (count (s/split text #" ")) 0.5))
(defn talk [entities target-id text & {:keys [stop? animate?]}]
(defn talk [entities target-id text & {:keys [stop? animate? anim]}]
(let [initial-time (atom nil)
stop? (if (nil? stop?) true stop?)
animate? (if (nil? animate?) true animate?)]
@@ -267,7 +267,7 @@
:target-id target-id
:scale scale)
(if animate?
(update-in entities [:room :entities target-id ] #(start-animation screen % :talk))
(update-in entities [:room :entities target-id ] #(start-animation screen % (or anim :talk)))
entities)))
(continue [this screen entities] entities)

View File

@@ -109,7 +109,7 @@
:ego "I have to go show my friends!")
(actions/walk-to entities :ego [85 145] :face :right)
(actions/transition-background entities :space [0 65])
(actions/walk-to entities :ego [150 65] :face :right)
(actions/walk-straight-to entities :ego [140 55] :face :right)
(actions/add-entity entities :blergh (get-in @entities [:room :blergh]))
(actions/play-animation entities :blergh :appear :stop? false)
(actions/transition-music entities :town-1 :fight)

View File

@@ -13,7 +13,8 @@
(defn taunt [screen entities]
(when (and (not (get-in entities [:actions :script-running?]))
(get-in entities [:state :active?]))
(get-in entities [:state :active?])
(not (get-in entities [:state :blergh-dead?])))
((actions/get-script entities (actions/do-dialogue entities :blergh (rand-nth ["Come on, little man! Try and hit me!"
"What's the matter? Cold feet?"
"Come here and fight me like man!"
@@ -28,7 +29,8 @@
blergh-talk-anim (animation 0.3 [blergh-talk blergh-stand])
blergh-stand-anim (animation 0.7 [blergh-flex blergh-stand])
blergh-swing (utils/make-anim "space/blergh-swing.png" [106 165] 0.1 [0 0 1 2 3 4 ])
blergh-appear (utils/make-anim "space/blergh-appear.png" [106 165] 0.05 (flatten [(range 10) 9 9 9 9 9 9 9 9 9 ]))]
blergh-appear (utils/make-anim "space/blergh-appear.png" [106 165] 0.05 (flatten [(range 10) 9 9 9 9 9 9 9 9 9 ]))
blergh-grow (utils/make-anim "space/blergh-grow.png" [106 165] 0.10 [0 1 0 1 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 5 6 7 8 9 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11]) ]
(rooms/make :music :town-1
:interactions
{}
@@ -39,6 +41,7 @@
:stand blergh-stand-anim :talk blergh-talk-anim
:swing blergh-swing
:appear blergh-appear
:grow blergh-grow
:talk-color (color 0.95 0.4 0.2 1.0)
:script (actions/get-script entities (actions/do-dialogue entities :blergh "Come on! Try and hit me!"))
:scripts {:sword (actions/get-script entities
@@ -53,4 +56,6 @@
:entities {}
:collision "space/collision.png"
:scale-fn (constantly 1.5)
:start-pos [43 80])))
:start-pos [43 80]
:apply-state (fn [e]
(assoc-in e [:room :entities :blergh] (get-in e [:room :blergh]))))))

View File

@@ -94,20 +94,28 @@
:blergh "You're still no match for me."
:blergh "Give it to me, or I'll make you regret it!")
(actions/present-choices entities {:choices ["Ok."
{:run #(do (actions/respond entities %
:ego "Here you go."
:blergh "Yes! Now I can drink this whole thing and can become powerful enough to rule the world!"
:blergh "[GREEN]*gulp*[]"
:blergh "What's this? What's happening?")
(actions/walk-straight-to entities :ego [100 45] :face :right)
(actions/do-dialogue entities :ego "TODO: explosion"
:ego "You win!"))}
{:run (fn [_]
(actions/talk entities :ego "Ok." :anim :grow-talk :stop? false)
(actions/talk entities :ego "Here you go." :anim :grow-talk)
(actions/do-dialogue entities
:blergh "Yes! Now I can drink this whole thing and can become powerful enough to rule the world!"
:blergh "[#AAFFAAFF]*gulp*[]"
:blergh "What's this? What's happening?")
(actions/talk entities :ego "Uh oh." :anim :grow-talk :stop? false)
(actions/walk-straight-to entities :ego [100 45] :face :right)
(actions/play-animation entities :blergh :grow :stop? false)
(actions/do-dialogue entities :ego "'Not more than that do drink,\nOr you'll push your body to the brink.'"
:ego "Brilliant! I win!")
(actions/walk-straight-to entities :ego [800 75] :face :right)
(actions/update-state entities (fn [s] (assoc s :blergh-dead? true))))}
"No way!"
{:run #(do (actions/respond entities % :blergh "Then take this!")
(actions/play-animation entities :blergh :swing)
(actions/walk-straight-to entities :ego [100 45] :anim :squat :override-dir :right :speed 3.0)
(actions/do-dialogue entities :ego "Yeow!!"
:ego "Even with that potion, I'm not strong enough."))}]}))
{:run (fn [_]
(actions/talk entities :ego "No way!" :anim :grow-talk)
(actions/talk entities :blergh "Then take this!")
(actions/play-animation entities :blergh :swing)
(actions/walk-straight-to entities :ego [100 45] :anim :squat :override-dir :right :speed 3.0)
(actions/do-dialogue entities :ego "Yeow!!"
:ego "Even with that potion, I'm not strong enough."))}]}))
(defn get-ego [screen start-pos start-scale]
@@ -149,6 +157,7 @@
(texture (aget grow-sheet 0 i))))
hold-up-to-window (utils/make-anim "ego/hold-up-to-window.png" [18 36] 0.1 [0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 0 0 0 0 0 0])
swing (utils/make-anim "ego/swing.png" [36 36] 0.05 (flatten [[0 0 0 1 2 3 3 3 3 ]]))
grow-talk (utils/make-anim "ego/grow-talk.png" [18 36] 0.2 (range 2))
get-sick (animation 0.3 (map (partial get [(aget talk-sheet 0 0 ) (texture "ego/get-sick.png")]) [0 1 1 1 1 1 1 1 1 1 1 1]) )
ego {:right {:walk walk-right
:stand stand-anim
@@ -164,6 +173,7 @@
:get-sick get-sick
:hold-up-to-window hold-up-to-window
:swing swing
:grow-talk grow-talk
[:fire 1] fire-1-anim
[:fire 2] fire-2-anim
[:fire 3] fire-3-anim}
@@ -180,6 +190,7 @@
:cat-toy-last-half (utils/flip cat-toy-last-half)
:grow (utils/flip grow)
:hold-up-to-window (utils/flip hold-up-to-window)
:grow-talk (utils/flip grow-talk)
[:fire 1] (utils/flip fire-1-anim)
[:fire 2] (utils/flip fire-2-anim)
[:fire 3] (utils/flip fire-3-anim)}