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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
<dict>
<key>duration</key>
<real>0.20000000298023224</real>
</dict>
</array>
</plist>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

View File

@@ -59,7 +59,8 @@
(defn talk [target-id text] (defn talk [target-id text]
(fn [screen entities] (fn [screen entities]
(run! dialogue/talking-screen :on-talk :text text (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) :target-id target-id)
(-> entities (-> 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] (defn get-ego [screen]
(let [player-sheet (texture! (texture "player.png") :split 18 36) (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)] ego {:right (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 0 i)))) (texture (aget player-sheet 0 i))))
:left (animation 0.075 (for [i (range 8)] :left (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 1 i)))) (texture (aget player-sheet 1 i))))
:talk (animation 0.2 (for [i (range 8)]
(texture (aget talk-sheet 0 i))))
:baseline 95 :baseline 95
:origin-x 9 :origin-x 9
@@ -94,8 +97,8 @@
background-trees (texture "background-trees.png") background-trees (texture "background-trees.png")
house (texture "house.png") house (texture "house.png")
overdirt (texture "overdirt.png") overdirt (texture "overdirt.png")
music (sound "outside-house.mp3") music (sound "town-music.mp3")
;; _ (sound! music :loop) _ (sound! music :loop)
] ]
{ {
:cursor {:id "cursor" :cursor-index 0 } :cursor {:id "cursor" :cursor-index 0 }
@@ -114,7 +117,8 @@
:interactions [{:mouse-in? (zone/box 258 100 281 160) :interactions [{:mouse-in? (zone/box 258 100 281 160)
:click-fn (fn [screen entities [x y]] :click-fn (fn [screen entities [x y]]
(assoc-in entities [:ego :actions] [(actions/stop :ego) (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) :scale-fn (scaler-fn-with-baseline 110 0.10 1.00)
:layers [(assoc background :x 0 :y 0 :baseline 0) :layers [(assoc background :x 0 :y 0 :baseline 0)
(assoc house :x 0 :y 0 :baseline 122) (assoc house :x 0 :y 0 :baseline 122)