new dialogue stuff.

This commit is contained in:
2014-10-09 22:34:03 -07:00
parent 6ce7dd3c1b
commit b9e441c516

View File

@@ -8,16 +8,64 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn do-game-player-dialogue [entities]
(actions/do-dialogue entities :ego "You there!" :game-player "... Yes?")
(actions/present-choices entities
{:choices ["Do you know anything about the sword in the stone up there?"
{:run #(actions/respond entities %
:game-player "It is said that only he who is worthy in wisdom can pull the sword!"
:game-player "I, of course have such wisdom, but I'm still unable to pull it myself.")
:choices ["Can you teach me your ways?"
{:run #(actions/respond entities %
:game-player "Ha! My intellect has only been achieved with years of precise training!"
:game-player "You're out of luck, friend. Unless you are willing to spend hours and hours in careful study, you will always be a dunce."
:ego "...")
:choices actions/previous-choices}
"How come?"
{:run #(actions/respond entities %
:game-player "You must be mighty in strength to pull the sword."
:game-player "And I spend all of my time either playing my game, or at the library.")
:choices actions/previous-choices}
"Something else."
{:choices actions/something-else}]}
"What are you playing?"
{:run #(actions/respond entities %
:game-player "It's called Warlock's Castle. "
:game-player "You play as a warlock, using skills and magic to reach the top of the tower of doom."
:game-player "If you want to reach the top of the tower, you must have the sharpest of minds."
:game-player "It's not for little kids like you."
:game-player "Even wise wizards like Mr. Fangald can't beat me!")
:choices ["Can I play with you?"
{:run #(actions/respond entities %
:game-player "You think YOU have what it takes to climb the stairs of treachery?"
:game-player "Or solve the riddle in the library of mystery?"
:game-player "Or break the curse that has entrapped the cave beast for 1000 years?"
:game-player "Very well.")}
"That sounds pretty dumb."
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say."
:choices actions/previous-choices)}
"Something else."
{:choices actions/something-else}]}
"Nevermind."
{:run #(actions/respond entities % :game-player "See you around.")}]}))
(defn make [screen]
(rooms/make :interactions
{:right-door {:box [286 140 306 160]
:cursor :right
:script (actions/get-script entities
(actions/walk-to entities :ego [284 145])
(actions/transition-background entities :outside-castle [82 180])
(actions/walk-to entities :ego [129 148]))}}
:layers [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-castle/pedestal-overlay.png") :x 0 :y 0 :baseline 135)]
:entities {:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191)}
:collision "inside-castle/collision.png"
:scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00)))
(let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44)
game-player-talk (animation 0.15 (for [i [0 2 0 2 0 2 0 3 0 2 0 1 0 0 0 0 2 0 2 0 3 0 1 0 1 0 0 1 0 2 0 3 0]]
(aget game-player-talk-sheet 0 i)))]
(rooms/make :interactions
{:right-door {:box [286 140 306 160]
:cursor :right
:script (actions/get-script entities
(actions/walk-to entities :ego [284 145])
(actions/transition-background entities :outside-castle [82 180])
(actions/walk-to entities :ego [129 148]))}}
:layers [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-castle/pedestal-overlay.png") :x 0 :y 0 :baseline 135)]
:entities {:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
:script (actions/get-script entities (do-game-player-dialogue entities))
:anim nil
:talk game-player-talk)}
:collision "inside-castle/collision.png"
:scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00))))