animations in all directions.

This commit is contained in:
2014-09-18 18:14:17 -07:00
parent 0ae2c5cea8
commit 5db858aae5
2 changed files with 40 additions and 23 deletions

View File

@@ -71,14 +71,20 @@
stand-sheet (texture! (texture "ego/stand.png") :split 18 36)
walk-right (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 0 i))))
ego {:right walk-right
:left (flip walk-right)
:talk (animation 0.2 (for [i (range 8)]
(texture (aget talk-sheet 0 i))))
:stand (animation 0.1 (for [i (flatten [(repeat 6 [(repeat 10 0) (repeat 3 1) (repeat 20 0)]) 3 4 5 5 5 6 5 6 5 6 5 4 3 ])]
(texture (aget stand-sheet 0 i))))
stand-anim (animation 0.1 (for [i (flatten [(repeat 6 [(repeat 10 0) (repeat 3 1) (repeat 20 0)]) 3 4 5 5 5 6 5 6 5 6 5 4 3 ])]
(texture (aget stand-sheet 0 i))))
talk-anim (animation 0.2 (for [i (range 8)]
(texture (aget talk-sheet 0 i))))
ego {:right {:walk walk-right
:stand stand-anim
:talk talk-anim}
:left {:walk (flip walk-right)
:stand (flip stand-anim)
:talk (flip talk-anim)}
:baseline 95
:facing :right
:origin-x 9
:origin-y 0
:scaled true
@@ -86,7 +92,7 @@
:x 150 :y 95
:id "ego"}]
(actions/start-animation screen
(merge (animation->texture screen (:stand ego)) ego)
(merge (animation->texture screen (:stand (:right ego))) ego)
:stand)))
(defn update-from-script [screen {{:keys [current started? channel]} :actions :as entities}]
@@ -200,14 +206,19 @@
entities
(actions/walk-to entities :ego [191 90])
(actions/talk entities :ego "Hello there, peddler.")
(actions/talk entities :peddler "Good day sir! Care to see any of my wares?")
(actions/talk entities :peddler "Good day sir! Care to see any of my wares?" :stop? false)
(actions/talk entities :peddler "I have only the choicest of wares.")
(actions/talk entities :ego "What 'wares' are you selling?")
(actions/talk entities :peddler "I have all types of wares...")
(actions/talk entities :peddler "...I'm well stocked on used earplugs...")
(actions/talk entities :peddler "...glass eyes, motivational tapes... ")
(actions/talk entities :peddler "...and useful books like this:")
(actions/talk entities :peddler "'Checkers Mastery in Less Than 10 Seconds'"))}}
(actions/talk entities :peddler "I have the choicest of all types of wares..." :stop? false)
(actions/talk entities :peddler "...I'm well stocked on used earplugs..." :stop? false)
(actions/talk entities :peddler "...glass eyes, motivational tapes... " :stop? false)
(actions/talk entities :peddler "...and useful books like this:" :stop? false)
(actions/talk entities :peddler "'Checkers Mastery in Less Than 10 Seconds'")
(actions/talk entities :ego "I sure ami interested on that book on checkers.")
(actions/talk entities :peddler "An excellent selection! It is the choicest of checkers book you'll ever find." :stop? false)
(actions/talk entities :peddler "This book will only set you back 75 sheckels.")
(actions/talk entities :ego "But I haven't got any money!")
(actions/talk entities :peddler "Then you won't have the choicest of checkers books."))}}
:layers [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
:entities {:peddler (actions/start-animation screen
(assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil
@@ -225,7 +236,7 @@
(update! screen :renderer (stage) :camera (orthographic))
(let [_ (input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
music (sound "town-music.mp3")
;; _ (sound! music :loop 0.20)
_ (sound! music :loop 0.20)
backgrounds (backgrounds screen)]
{:backgrounds backgrounds
:actions {:object nil