reworked dialogue

This commit is contained in:
2015-02-18 08:29:52 -08:00
parent 352bfb9238
commit c7591dd3f2
4 changed files with 107 additions and 71 deletions

View File

@@ -24,6 +24,7 @@
"Pick up your weapon and fight!"]))) entities))
nil)
(defn start-swing-if-necessary [screen e]
(if (and (not= (:anim e) :swing)
(> (:x e) 190))
@@ -151,56 +152,60 @@
{}
:layers [(assoc (texture "space/background.png") :x 0 :y 0 :baseline 0)]
:timers {:taunt [10.0 8.0 taunt]}
:bloodclot-head (rooms/make-entity :bloodclot-head (assoc (animation->texture screen bloodclot-head-stand-anim)
:x 195 :y 138 :baseline 195
:anim bloodclot-head-stand-anim
:talk bloodclot-head-talk-anim
:keep-shoot bloodclot-head-keep-shoot-anim
:shoot bloodclot-head-shoot-anim
:anim-start 0
:stand bloodclot-head-stand-anim
:talk-color (color 0.95 0.4 0.2 1.0)))
:entities {:bloodclot-head (assoc (animation->texture screen bloodclot-head-stand-anim)
:x 195 :y 138 :baseline 195
:opacity 0.0
:anim bloodclot-head-stand-anim
:talk bloodclot-head-talk-anim
:keep-shoot bloodclot-head-keep-shoot-anim
:shoot bloodclot-head-shoot-anim
:anim-start 0
:stand bloodclot-head-stand-anim
:talk-color (color 0.95 0.4 0.2 1.0))
:bloodclot (assoc (animation->texture screen blergh-stand-anim)
:x 180 :y 50 :baseline 190
:stand blergh-stand-anim
:opacity 0.0
:appear blergh-appear
:grow blergh-grow
:script (actions/get-script entities (actions/do-dialogue entities :bloodclot-head "Come on! Try and hit me!"))
:scripts {:sword (actions/get-script entities
(swing-at-blergh entities)
(actions/do-dialogue entities :bloodclot-head "Ha ha ha! Is that the best you can do?"
:bloodclot-head "Take this!")
:blergh (rooms/make-entity :blergh (assoc (animation->texture screen blergh-stand-anim)
:x 180 :y 50 :baseline 190
:stand blergh-stand-anim
:appear blergh-appear
:grow blergh-grow
:script (actions/get-script entities (actions/do-dialogue entities :bloodclot-head "Come on! Try and hit me!"))
:scripts {:sword (actions/get-script entities
(swing-at-blergh entities)
(actions/do-dialogue entities :bloodclot-head "Ha ha ha! Is that the best you can do?"
:bloodclot-head "Take this!")
(sound! (sound "space/shock.ogg") :play)
(actions/play-animation entities :bloodclot-head :shoot :stop? false)
(actions/begin-animation entities :bloodclot-head :keep-shoot)
(actions/play-animation entities :ego :shock :stop? false)
(actions/begin-animation entities :bloodclot-head :stand)
(actions/play-animation entities :ego :burnt :stop? false)
(actions/play-animation entities :ego :passed-out :continue? true)
(common/go-to-jail entities)
#_(actions/do-dialogue entities :ego "Hey!"
:ego "What's going on? I was just about to teach Blergh a lesson!"))
:magic-slingshot (actions/get-script entities
(actions/do-dialogue entities
:ego "Hey Blergh!"
:ego "Take this!")
(actions/play-animation entities :ego :shoot)
(actions/add-entity entities :bullet (get-in @entities [:room :bullet]))
(actions/walk-straight-to entities :bullet [213 166] :update-baseline? false :speed 5.0)
(actions/add-entity entities :broken-jewel (get-in @entities [:room :broken-jewel]))
(Thread/sleep 500)
(actions/remove-entity entities :bullet)
(actions/update-state entities #(assoc % :broke-jewel? true))
(actions/do-dialogue entities
:blergh "Argh! My magic lightning helmet!"
:blergh "No matter. I will destroy you with my bare hands!"))}))
:entities {}
(sound! (sound "space/shock.ogg") :play)
(actions/play-animation entities :bloodclot-head :shoot :stop? false)
(actions/begin-animation entities :bloodclot-head :keep-shoot)
(actions/play-animation entities :ego :shock :stop? false)
(actions/begin-animation entities :bloodclot-head :stand)
(actions/play-animation entities :ego :burnt :stop? false)
(actions/play-animation entities :ego :passed-out :continue? true)
(actions/do-dialogue entities :bloodclot-head "Oh shucks. I overcooked him."
:bloodclot-head "No matter."
:bloodclot-head "Tomorrow, I will return with my legion of goblins."
:bloodclot-head "And THEN the feast will begin."
:bloodclot-head "Starting with his precious Georgia McGorgeous.")
(common/go-to-jail entities)
#_(actions/do-dialogue entities :ego "Hey!"
:ego "What's going on? I was just about to teach Blergh a lesson!"))
:magic-slingshot (actions/get-script entities
(actions/do-dialogue entities
:ego "Hey Blergh!"
:ego "Take this!")
(actions/play-animation entities :ego :shoot)
(actions/add-entity entities :bullet (get-in @entities [:room :bullet]))
(actions/walk-straight-to entities :bullet [213 166] :update-baseline? false :speed 5.0)
(actions/add-entity entities :broken-jewel (get-in @entities [:room :broken-jewel]))
(Thread/sleep 500)
(actions/remove-entity entities :bullet)
(actions/update-state entities #(assoc % :broke-jewel? true))
(actions/do-dialogue entities
:bloodclot-head "Argh! My magic lightning helmet!"
:bloodclot-head "No matter. I will destroy you with my bare hands!"))})}
:bullet (assoc (animation->texture screen bullet)
:x 130 :y 85 :baseline 241
:walk bullet)
@@ -214,6 +219,10 @@
(if (get-in e [:state :broke-jewel?])
(assoc-in e [:room :entities :broken-jewel] (get-in e [:room :entities :broken-jewel]))
e)
(assoc-in e [:room :entities :blergh] (get-in e [:room :blergh]))
(assoc-in e [:room :entities :bloodclot-head] (get-in e [:room :bloodclot-head])))
))))
(if (get-in e [:state :seen-bloodclot?])
(assoc-in e [:room :entities :bloodclot :opacity ] 1.0)
e)
(if (get-in e [:state :seen-bloodclot?])
(assoc-in e [:room :entities :bloodclot-head :opacity ] 1.0)
e)
(assoc-in e [:state :seen-bloodclot?] true))))))