bloodclot scene.

This commit is contained in:
2015-05-11 23:12:27 -07:00
parent c6aad2a33b
commit 31d2dbf5e9
8 changed files with 90 additions and 15 deletions

View File

@@ -160,13 +160,13 @@
entity))))
(defn stop [screen entities target-id & {:keys [face]}]
(update-in entities [:room :entities target-id] (comp #(start-animation screen % :stand) (if face #(assoc % :facing face) identity))))
(update-in entities [:room :entities target-id] (comp #(start-animation screen % (or (:stand-override %) :stand) ) (if face #(assoc % :facing face) identity))))
(defn do-stop [entities target-id & {:keys [face]}]
(run-action entities
(begin [this screen entities]
(update-in entities [:room :entities target-id]
(comp #(start-animation screen % :stand) (if face #(assoc % :facing face) identity))))
(comp #(start-animation screen % (or (:stand-override %) :stand)) (if face #(assoc % :facing face) identity))))
(continue [this screen entities] entities)
(done? [this screen entities] true)
(terminate [this screen entities]
@@ -365,7 +365,7 @@
:target-id target-id
:scale scale)
(if animate?
(update-in entities [:room :entities target-id ] #(start-animation screen % (or anim :talk)))
(update-in entities [:room :entities target-id ] #(start-animation screen % (or anim (:talk-override %) :talk)))
entities)))
(continue [this screen entities] entities)

View File

@@ -93,3 +93,18 @@
(defn listen-to-frankie [entities]
((rand-nth [listen-1 listen-2 listen-3]) entities))
(defn win []
(actions/get-script entities
(actions/do-dialogue entities
:ego "Hey Bloodclot!"
:ego "I have this potion which will make me as strong as you!"
:bloodclot-head "What?!"
:bloodclot-head "Give it here!")
(actions/transition-background entities :space [200 45])
(actions/do-dialogue entities
:bloodclot-head "Yes!"
:bloodclot-head "Ultimate power is mine!"
:bloodclot-head "If I drink this entire bottle, I'll be as powerful as a god!")
(Thread/sleep 5000)))

View File

@@ -14,22 +14,75 @@
[play-clj.math :refer :all]
[play-clj.g2d :refer :all]))
(defn bloodclot-choices [entities]
(actions/present-choices entities {:choices ["I'm just a kid! You wouldn't eat a kid, would you?"
{:run #(actions/respond entities %
:bloodclot-head "But I love eating young, tender children!"
:bloodclot-head "My mother would sing while making children stew."
:bloodclot-head "'Eat the humans while they're young,'\n'Eat the liver, spleen, and lung!'"
:bloodclot-head "Just singing that makes my mouth water.")
:choices actions/previous-choices}
"I'm covered in poison!"
{:run #(actions/respond entities %
:bloodclot-head "Actually, us goblins quite enjoy poison."
:bloodclot-head "It's like a good hotsauce."
:bloodclot-head "A good poison makes the meal pack a punch.")
:choices actions/previous-choices}
"I've got something in my pocket you might be interested in."
{:run #(do (actions/respond entities %
:bloodclot-head "Oh yeah, like what?")
(actions/update-entities entities (fn [e] (assoc-in e [:room :bloodclot-timer] 0))))}]}))
(defn add-second [screen entities]
(when (and (not (get-in entities [:actions :script-running?]))
(get-in entities [:state :active?]))
(if (> (get-in entities [:room :bloodclot-timer] 0) 7)
(do
((actions/get-script entities (actions/talk entities :bloodclot-head "Time is up, runt.")
(bloodclot-choices entities)) entities)
nil)
(update-in entities [:room :bloodclot-timer] (fnil inc 0)))))
(defn bloodclot-talk-script [entities]
(actions/talk entities :ego "Let me down Bloodclot!" :anim :suspended-talk)
(actions/do-dialogue entities :bloodclot-head "Not a chance."
:bloodclot-head "It's dinnertime, runt."))
(actions/do-dialogue entities :bloodclot-head "You've been a nuisance since I first met you!"
:bloodclot-head "Why shouldn't I gobble you up?")
(bloodclot-choices entities))
(defn fail-item [who msg]
(actions/get-script entities
(actions/talk entities who msg)))
(defn make [screen]
(let [bloodclot-talk (utils/make-anim "held/bloodclot-head.png" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
bloodclot-stand (utils/make-anim "held/bloodclot-head.png" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))]
(rooms/make :music :fight
:interactions {}
:layers [(assoc (texture "held/background.png") :x 0 :y 0 :baseline 0)]
:interactions {:bloodclot {:box [182 42 270 196]
:script (actions/get-script entities
(bloodclot-talk-script entities))
:scripts #(condp = %
:magic-slingshot (fail-item :ego "I only had one bullet!")
:spear (fail-item :ego "I'm not strong enough to reach it!")
:sword (fail-item :ego "I'm not strong enough to reach it!")
:crowbar (fail-item :ego "I'm not strong enough to reach it!")
:medal (fail-item :bloodclot-head "Where is your might now, runt?")
:trophy (fail-item :bloodclot-head "Seems like your wisdom has failed you today.")
:kiss (fail-item :bloodclot-head "Your bravery won't save you from my belly!")
:note-1 (fail-item :bloodclot-head "I'm afraid Gandarf will be of no use to you now.")
:note-2 (fail-item :bloodclot-head "I'm afraid Gandarf will be of no use to you now.")
:flask-1-strength (common/win)
(actions/get-script entities
(actions/talk entities :bloodclot-head "Don't make me laugh kid!")))
}}
:timers {:taunt [5.0 1.0 add-second]}
:layers [(assoc (texture "held/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "held/hand.png") :x 0 :y 0 :baseline 240)]
:entities {:bloodclot-head (assoc (animation->texture screen bloodclot-stand)
:x 211 :y 114 :baseline 240
:x 211 :y 115 :baseline 240
:origin-x 57 :origin-y 0
:script (actions/get-script entities
(bloodclot-talk-script entities))
:stand bloodclot-stand
:talk bloodclot-talk
:anim bloodclot-stand
@@ -41,4 +94,6 @@
(-> e
(assoc-in [:cam :paused? ] true)
(update-in [:tweens] dissoc :cam-x :cam-y)
(update-in [:room :entities :ego] #(actions/start-animation screen % :suspended)))))))
(update-in [:room :entities :ego] #(actions/start-animation screen % :suspended))
(assoc-in [:room :entities :ego :stand-override] :suspended)
(assoc-in [:room :entities :ego :talk-override] :suspended-talk))))))

View File

@@ -1,6 +1,7 @@
(ns advent.screens.rooms.space
(:require [advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.screens.rooms.held :as held]
[advent.actions :as actions]
[advent.screens.items :as items]
[advent.utils :as utils]
@@ -264,7 +265,13 @@
:bloodclot-head "Argh! My lightning gem!"
:bloodclot-head "No matter. I will rip you apart with my bare hands!")
(actions/pause-camera entities)
(actions/transition-background entities :held [125 170]))})}
(actions/transition-background entities :held [113 120])
(actions/do-dialogue entities :bloodclot-head "Time to die, runt."
:bloodclot-head "No one injures Bloodclot and lives to talk about it!"
:ego "Let me down and fight me fair and square!"
:bloodclot-head "I'm three times as mighty as you."
:bloodclot-head "I'd rather have you as a tasty morsel.")
(held/bloodclot-choices entities))})}
:bullet (assoc (animation->texture screen bullet)
:x 37 :y 85 :baseline 241
:walk bullet)

View File

@@ -463,9 +463,7 @@ void main()
:scale-x start-scale
:scale-y start-scale
:talk-color (color 0.6 1.0 1.0 1.0)
:stand-override nil
:mouse-in? (fn [entities x y]
(let [{entity-x :x entity-y :y region :object scale :scale-x} (get-in entities [:room :entities :ego])
half-width (/ (* (.getRegionWidth region) (or scale 1.0)) 2)