talking animation.

This commit is contained in:
=
2014-09-08 13:12:58 -07:00
parent 02538a8c05
commit 0507b26cca
14 changed files with 48 additions and 5 deletions

View File

@@ -59,7 +59,8 @@
(defn talk [target-id text]
(fn [screen entities]
(run! dialogue/talking-screen :on-talk :text text
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) 25)
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) 35)
:target-id target-id)
(-> entities
(update-in [target-id :actions] rest))))
(update-in [target-id :actions] rest)
(assoc-in [target-id :anim] (get-in entities [target-id :talk])))))

View File

@@ -56,10 +56,13 @@
(defn get-ego [screen]
(let [player-sheet (texture! (texture "player.png") :split 18 36)
talk-sheet (texture! (texture "ego/talk.png") :split 16 36)
ego {:right (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 0 i))))
:left (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 1 i))))
:talk (animation 0.2 (for [i (range 8)]
(texture (aget talk-sheet 0 i))))
:baseline 95
:origin-x 9
@@ -94,8 +97,8 @@
background-trees (texture "background-trees.png")
house (texture "house.png")
overdirt (texture "overdirt.png")
music (sound "outside-house.mp3")
;; _ (sound! music :loop)
music (sound "town-music.mp3")
_ (sound! music :loop)
]
{
:cursor {:id "cursor" :cursor-index 0 }
@@ -114,7 +117,8 @@
:interactions [{:mouse-in? (zone/box 258 100 281 160)
:click-fn (fn [screen entities [x y]]
(assoc-in entities [:ego :actions] [(actions/stop :ego)
(actions/talk :ego "Looking at the house.")]))}]
(actions/talk :ego (str "The last time I went through that door, \n"
"Fangald turned me into a frog."))]))}]
:scale-fn (scaler-fn-with-baseline 110 0.10 1.00)
:layers [(assoc background :x 0 :y 0 :baseline 0)
(assoc house :x 0 :y 0 :baseline 122)