refinement.

This commit is contained in:
2014-12-10 13:07:08 -08:00
parent bb7dcb3628
commit 3639e4fd06
4 changed files with 72 additions and 50 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -24,7 +24,31 @@
(doseq [scenario (take 2 (shuffle scenarios))]
(scenario))))
(defn nice-trophy-dialogue [entities]
{:run #(actions/respond entities %
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
:game-player "I guess I'm pretty wise."
:game-player "And with my sharp intellect, I'm guessing you want my trophy?")
:choices ["Yes."
{:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool)))
(actions/respond entities %
:game-player "Well, if you want my trophy, you'll have to earn it."
:game-player "There are a few riddles that even I, the wisest in all of Remington, cannot solve."
:game-player "How about you help me?"
:game-player "Bring me the answer:"
:game-player "White as snow, but not as cold,"
:game-player "Keeps you warm, or so I'm told."
:ego "Okay."))}
"No."
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say.")
}]})
(defn walk-to-player [entities]
(actions/walk-to entities :ego [210 73] :face :right))
(defn do-game-player-dialogue [entities]
(walk-to-player 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?"
@@ -46,24 +70,7 @@
{:choices actions/something-else}]}
(when (= nil (get-in @entities [:state :current-riddle]))
"Nice trophy.")
{:run #(actions/respond entities %
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
:game-player "I guess I'm pretty wise."
:game-player "And with my sharp intellect, I'm guessing you want my trophy?")
:choices ["Yes."
{:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool)))
(actions/respond entities %
:game-player "Well, if you want my trophy, you'll have to earn it."
:game-player "There are a few riddles that even I, the wisest in all of Remington, cannot solve."
:game-player "How about you help me?"
:game-player "Bring me the answer:"
:game-player "White as snow, but not as cold,"
:game-player "Keeps you warm, or so I'm told."
:ego "Okay."))}
"No."
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say.")
:choices actions/something-else}]}
(nice-trophy-dialogue entities)
(when (= :wool (get-in @entities [:state :current-riddle]))
"What was that riddle again?")
@@ -91,7 +98,8 @@
(defn make [screen]
(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)))]
(aget game-player-talk-sheet 0 i)))
trophy (utils/make-anim "inside-castle/trophy.png" [16 16] 0.1 (flatten [(repeat 50 0) 1 2 3 3 3 3 2 1]))]
(rooms/make :music :town-1
:interactions
{:right-door {:box [286 140 306 160]
@@ -132,9 +140,22 @@
(actions/talk entities :ego "Ye Ol' Antique Shoppe."))}}
: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
:entities {:trophy (assoc (animation->texture screen trophy)
:x 253 :y 69 :baseline 191
:anim trophy
:anim-start 0
:script (actions/get-script entities
(walk-to-player entities)
(if (= nil (get-in @entities [:state :current-riddle]))
(let [{:keys [run choices]} (nice-trophy-dialogue entities)]
(run "Nice trophy.")
(actions/present-choices entities {:choices choices}))
(actions/do-dialogue entities :ego "Can't you give me your trophy of wisdom?"
:game-player "If you want my trophy, you'll have to help me with my riddles."))))
:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
:script (actions/get-script entities (do-game-player-dialogue entities))
:scripts {:wool (actions/get-script entities
(walk-to-player entities)
(if (= :wool (get-in @entities [:state :current-riddle]))
(do (actions/update-state entities #(assoc % :current-riddle :balloon))
(actions/remove-item entities :wool)
@@ -144,6 +165,7 @@
:game-player "If you want to keep it, best have a tether."))
(actions/talk entities :ego "He doesn't need it.")))
:balloon (actions/get-script entities
(walk-to-player entities)
(if (= :balloon (get-in @entities [:state :current-riddle]))
(do (actions/update-state entities #(assoc % :current-riddle :frog-legs))
(actions/remove-item entities :balloon)
@@ -153,6 +175,7 @@
:game-player "Now I'm dead, or at least a have a scar."))
(actions/talk entities :ego "He doesn't need it.")))
:frog-legs (actions/get-script entities
(walk-to-player entities)
(if (= :frog-legs (get-in @entities [:state :current-riddle]))
(do (actions/update-state entities #(assoc % :current-riddle :done))
@@ -161,7 +184,8 @@
:game-player "Wow! That's right!"
:game-player "I guess I'm not the wisest person in Remington."
:game-player "You have earned my trophy.")
(actions/give entities :trophy))
(actions/give entities :trophy)
(actions/remove-entity entities :trophy))
(actions/talk entities :ego "He doesn't need it.")))}
:anim nil
:talk game-player-talk)}

View File

@@ -14,7 +14,7 @@
(let [peddler-sheet (texture! (texture "outside-castle/peddler-talk.png" ) :split 18 36)
peddler-talk (animation 0.18 (for [i (flatten [2 3 2 3 2 3 6 1 0 1 0 1 0 1 0 1 2 3 2 3 2 3 6 4 5 4 5 4 5 4 5])]
(aget peddler-sheet 0 i)))
peddler-stand (animation 0.2 (for [i (flatten [(repeat 5 0) 6])]
peddler-stand (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 8 0) 6 (repeat 5 0) 4 5 4 5 4 5])]
(aget peddler-sheet 0 i)))
balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36)
balloon-stand (animation 0.25 (for [i [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0 1 2]]
@@ -22,16 +22,11 @@
bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2)
bird-stand (animation 0.15 (for [i [0 1]]
(aget bird-sheet 0 i)))
butterfly-sheet (texture! (texture "butterfly.png") :split 7 7)
butterfly-stand (animation 0.1 (for [i [0 1]]
(aget butterfly-sheet 0 i)))
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
steer-sheet (texture! (texture "outside-castle/steer.png") :split 50 35)
steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]]
(aget steer-sheet 0 i)))
flies-sheet (texture! (texture "outside-castle/flies.png") :split 15 15)
flies-stand (animation 0.075 (for [i [0 1 2 1]]
(aget flies-sheet 0 i)))
]
flies-stand (utils/make-anim "outside-castle/flies.png" [15 15] 0.075 [0 1 2 1])]
(rooms/make :music :town-2
:interactions
{:right-dir {:box [300 40 320 140]
@@ -187,27 +182,25 @@
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))
:stand)
:butterfly (actions/start-animation screen
(assoc (animation->texture screen butterfly-stand)
:x 161
:y 218
:baseline 240
:stand butterfly-stand
:path (catmull-rom-spline (map #(apply vector-2* %) (take 10 (repeatedly #(vector (rand-int 320) (rand-int 180))))) true)
:update-fn (fn [screen entities entity]
(let [speed 0.009
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
v (vector-2 0 0)
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))
:stand)
:flies (actions/start-animation screen
(assoc (animation->texture screen flies-stand)
:x 201
:y 175
:baseline 240
:stand flies-stand)
:stand)}
:butterfly (assoc (animation->texture screen butterfly-stand)
:x 161
:y 218
:baseline 240
:anim butterfly-stand
:anim-start 0
:path (catmull-rom-spline (map #(apply vector-2* %) (take 10 (repeatedly #(vector (rand-int 320) (rand-int 180))))) true)
:update-fn (fn [screen entities entity]
(let [speed 0.009
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
v (vector-2 0 0)
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))
:flies (assoc (animation->texture screen flies-stand)
:x 201
:y 175
:anim flies-stand
:anim-start 0
:baseline 240)}
:collision "outside-castle/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:start-pos [310 80])))

View File

@@ -74,3 +74,8 @@
(texture! frame :set-region src-frame)
(texture! frame :flip true false)
frame))))
(defn make-anim [file [w h] speed frames]
(let [sheet (texture! (texture file) :split w h)]
(animation speed (for [i frames]
(aget sheet 0 i)))))