animation for fire mint.

This commit is contained in:
2014-11-09 10:49:19 -08:00
parent 86d1f7273d
commit 0b27e1642d
17 changed files with 75 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,54 @@
<?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>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

View File

@@ -12,7 +12,7 @@
[advent.utils :as utils] [advent.utils :as utils]
[clojure.core.async :refer [put! <! <!! >! >!! chan go thread take! alts!!]]) [clojure.core.async :refer [put! <! <!! >! >!! chan go thread take! alts!!]])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter] (:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion] [com.badlogic.gdx.graphics.g2d TextureRegion Animation]
[com.badlogic.gdx Screen])) [com.badlogic.gdx Screen]))
(defprotocol IAction (defprotocol IAction
@@ -42,10 +42,10 @@
entity))) entity)))
(defn find-animation [entity anim] (defn find-animation [entity anim]
(if (keyword? anim) (if (instance? Animation anim)
anim
(or (get-in entity [(:facing entity) anim]) (or (get-in entity [(:facing entity) anim])
(anim entity)) (get entity anim))))
anim))
(defn start-animation [screen entity anim] (defn start-animation [screen entity anim]
(let [new-anim (find-animation entity anim)] (let [new-anim (find-animation entity anim)]

View File

@@ -135,6 +135,7 @@
(actions/talk entities :ego "I'll just try one of these mints.") (actions/talk entities :ego "I'll just try one of these mints.")
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/update-state entities (fn [s] (assoc s :mints-eaten (inc (s :mints-eaten))))) (actions/update-state entities (fn [s] (assoc s :mints-eaten (inc (s :mints-eaten)))))
(actions/play-animation entities :ego [:fire (get-in @entities [:state :mints-eaten])])
(actions/talk entities :ego "WOWZA! Those are hot.") (actions/talk entities :ego "WOWZA! Those are hot.")
(when (= 3 (get-in @entities [:state :mints-eaten])) (when (= 3 (get-in @entities [:state :mints-eaten]))
(actions/talk entities :shopkeep "You brat! You ate the last mint.") (actions/talk entities :shopkeep "You brat! You ate the last mint.")

View File

@@ -83,6 +83,7 @@
squat-sheet (texture! (texture "ego/squat.png") :split 18 36) squat-sheet (texture! (texture "ego/squat.png") :split 18 36)
reach-sheet (texture! (texture "ego/reach.png") :split 18 36) reach-sheet (texture! (texture "ego/reach.png") :split 18 36)
cat-toy-sheet (texture! (texture "ego/cat-toy.png") :split 41 50) cat-toy-sheet (texture! (texture "ego/cat-toy.png") :split 41 50)
fire-sheet (texture! (texture "ego/fire.png") :split 18 36)
walk-right (animation 0.075 (for [i (range 8)] walk-right (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 0 i)))) (texture (aget player-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 ])] 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 ])]
@@ -94,19 +95,31 @@
reach-anim (animation 0.1 (for [i [0 1 2 3 3 3 3 3 3 2 1 0]] reach-anim (animation 0.1 (for [i [0 1 2 3 3 3 3 3 3 2 1 0]]
(texture (aget reach-sheet 0 i)))) (texture (aget reach-sheet 0 i))))
cat-toy-anim (animation 0.1 (for [i [0 0 1 1 2 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 2 1 1 0 0]] cat-toy-anim (animation 0.1 (for [i [0 0 1 1 2 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 2 1 1 0 0]]
(texture (aget cat-toy-sheet 0 i)))) (texture (aget cat-toy-sheet 0 i))))
fire-1-anim (animation 0.1 (for [i [0 1 2 2 2 3 2 3 2 2 2 1 0]]
(texture (aget fire-sheet 0 i))))
fire-2-anim (animation 0.1 (for [i [0 1 2 2 2 2 3 2 3 2 2 2 4 5 6 7 2 2 2 2 2 2 2 2 1 0]]
(texture (aget fire-sheet 0 i))))
fire-3-anim (animation 0.1 (for [i [0 1 2 2 2 2 3 2 3 2 2 2 4 5 6 7 2 2 2 8 9 10 11 2 2 2 2 2 2 2 2 0]]
(texture (aget fire-sheet 0 i))))
ego {:right {:walk walk-right ego {:right {:walk walk-right
:stand stand-anim :stand stand-anim
:talk talk-anim :talk talk-anim
:squat squat-anim :squat squat-anim
:reach reach-anim :reach reach-anim
:cat-toy cat-toy-anim} :cat-toy cat-toy-anim
[:fire 1] fire-1-anim
[:fire 2] fire-2-anim
[:fire 3] fire-3-anim}
:left {:walk (utils/flip walk-right) :left {:walk (utils/flip walk-right)
:stand (utils/flip stand-anim) :stand (utils/flip stand-anim)
:talk (utils/flip talk-anim) :talk (utils/flip talk-anim)
:squat (utils/flip squat-anim) :squat (utils/flip squat-anim)
:reach (utils/flip reach-anim) :reach (utils/flip reach-anim)
:cat-toy (utils/flip cat-toy-anim)} :cat-toy (utils/flip cat-toy-anim)
[:fire 1] (utils/flip fire-1-anim)
[:fire 2] (utils/flip fire-2-anim)
[:fire 3] (utils/flip fire-3-anim)}
:baseline 95 :baseline 95
:facing :right :facing :right
:origin-x 9 :origin-x 9