ego is all atlased

This commit is contained in:
Bryce Covert
2017-05-27 16:33:45 -07:00
parent 26b0952345
commit 5332683347
36 changed files with 238 additions and 253 deletions

View File

@@ -32,6 +32,11 @@
(set-asset-manager! am)
(defn create-game [advent]
(set-screen-wrapper! (fn [screen screen-fn]
(try (screen-fn)
(catch Exception e
(.log Gdx/app "ERROR" (with-out-str (.printStackTrace e)))
(set-screen! advent title/title-screen)))))
(log/log-capture! *ns* :warn :error)
(log/info "Starting game on version v" (advent.version/version))
(utils/listen-for-screenshots)
@@ -46,8 +51,4 @@
(defn reload []
(on-gl (set-screen! advent title/title-screen)))
(set-screen-wrapper! (fn [screen screen-fn]
(try (screen-fn)
(catch Exception e
(.log Gdx/app "ERROR" (with-out-str (.printStackTrace e)))
(set-screen! advent title/title-screen)))))

View File

@@ -434,15 +434,15 @@
nil))
(defn get-ego [screen start-pos start-scale]
(let [player-sheet (texture! (utils/get-texture "player.png") :split 18 36)
talk-sheet (texture! (utils/get-texture "ego/talk.png") :split 18 36)
stand-sheet (texture! (utils/get-texture "ego/stand.png") :split 18 36)
squat-sheet (texture! (utils/get-texture "ego/squat.png") :split 18 36)
reach-sheet (texture! (utils/get-texture "ego/reach.png") :split 18 36)
grow-sheet (texture! (utils/get-texture "ego/grow.png") :split 18 36)
cat-toy-sheet (texture! (utils/get-texture "ego/cat-toy.png") :split 41 50)
fire-sheet (texture! (utils/get-texture "ego/fire.png") :split 18 36)
(defn get-ego [screen global-atlas start-pos start-scale]
(let [player-sheet (texture! (utils/atlas->texture global-atlas "ego/player") :split 18 36)
talk-sheet (texture! (utils/atlas->texture global-atlas "ego/talk") :split 18 36)
stand-sheet (texture! (utils/atlas->texture global-atlas "ego/stand") :split 18 36)
squat-sheet (texture! (utils/atlas->texture global-atlas "ego/squat") :split 18 36)
reach-sheet (texture! (utils/atlas->texture global-atlas "ego/reach") :split 18 36)
grow-sheet (texture! (utils/atlas->texture global-atlas "ego/grow") :split 18 36)
cat-toy-sheet (texture! (utils/atlas->texture global-atlas "ego/cat-toy") :split 41 50)
fire-sheet (texture! (utils/atlas->texture global-atlas "ego/fire") :split 18 36)
walk-right (animation 0.075 (for [i (range 8)]
(texture (aget player-sheet 0 i))))
@@ -487,46 +487,46 @@
(texture (aget fire-sheet 0 i))))
grow (animation 0.1 (for [i [0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 3 0 0 0 0 3 0 0 0 3 3 0 0 0 2 2 0 0 2 0 0 2 0 2 0 2 0 2 0 2 0 2 3 2 3 2 3 2 3 2 4 3 4 3 4 3 4]]
(texture (aget grow-sheet 0 i))))
squat-talk (utils/make-anim "ego/squat-talk.png" [18 36] 0.2 [0 1 0 2 1 0 3])
frog (utils/make-anim "ego/frog.png" [16 36] 0.1 [0])
frog-nod (utils/make-anim "ego/frog.png" [16 36] 0.2 [0 1 0 1 0 1 0 1])
hold-up-to-window (utils/make-anim "ego/hold-up-to-window.png" [18 36] 0.1 [0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 0 0 0 0 0 0])
jump (utils/make-anim "ego/swing.png" [36 75] 0.2 (flatten [[1 2]]))
jump-straight (utils/make-anim "ego/jump-straight.png" [18 48] 0.075 [0 1 1 1 1 1 1 2 3])
climb (utils/make-anim "ego/climb.png" [22 46] 0.3 [0 1 3 2 4 3 2 4 3 5 6 5 6 5 6 5 6 5 6 7 8 7 8 9 10 9 10 10 10 10 10 8 8 6 6 1 0])
poke (utils/make-anim "ego/poke.png" [20 50] 0.2 [0 1 2 3 2 3 2 3 2 3 1 0])
jumping-straight (utils/make-anim "ego/jump-straight.png" [18 48] 0.075 (repeat 30 4))
swing (utils/make-anim "ego/swing.png" [36 75] 0.145 (flatten [[3 4 5 6 7 ]]))
grow-talk (utils/make-anim "ego/grow-talk.png" [18 36] 0.2 (range 2))
get-sick (utils/make-anim "ego/get-sick.png" [18 36] 0.1 (flatten [(range 6) (repeat 10 5) (reverse (range 6) ) 0 0 0 0 0 0]))
spear (utils/make-anim "ego/spear.png" [18 100] 0.2 [0 1 2 3 2 3 2 3 2 3 2 1 0])
crowbar (utils/make-anim "ego/crowbar.png" [36 36] 0.1 [0 0 0 1 1 2 2 2 2 2 3 2 3 2 3 2 3 2 3 3 3 1 1 0 0 0])
shoot (utils/make-anim "ego/shoot.png" [24 36] 0.075 [0 0 0 1 1 2 2 2 2 2 2 2 2 3 4 5 4])
pant (utils/make-anim "ego/pant.png" [31 36] 0.5 [0 1])
shock (utils/make-anim "ego/shock.png" [40 48] 0.075 (flatten (repeat 2 [(repeat 5 [0 1 2]) (repeat 5 [3 4 5]) (repeat 5 [6 7 8])])))
burnt (utils/make-anim "ego/burnt.png" [40 46] 0.12 [1 2 3 2 1 2 3 2 1 0 2 0 4 5 6 7 8 9 10 11 10 9 10 11])
passed-out (utils/make-anim "ego/burnt.png" [40 46] 0.12 [9 10 11 10])
scared (utils/make-anim "ego/scared.png" [18 36] 0.05 [0 1])
scared-talk (utils/make-anim "ego/scared.png" [18 36] 0.05 [0 1 0 1 0 1 0 1 2 3 2 3 2 3 2 3])
scared-walk (utils/make-anim "ego/scared-walk.png" [16 36] 0.05 (range 6))
sigh (utils/make-anim "ego/sigh.png" [18 36] 0.08 [0 0 0 0 1 1 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 0 0 0 0 ])
glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 8 [5 5 5]) (repeat 20 0)]))
milk (utils/make-anim "ego/squat.png" [18 36] 0.05 [0 1 2 2 3 3 3 3 3 3 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 3 3 3 3 3 3 3 3 3 3 3 2 1 0])
idea (utils/make-anim "ego/idea.png" [18 70] 0.3 [2 0 0 0 0 0 0 2])
throw (utils/make-anim "ego/throw.png" [18 36] 0.04 (flatten [[(repeat 5 0) (repeat 10 1)] (repeat 3 [2 2 2 3 3 3 4 4 4 5 5 5]) (repeat 5 [2 2 3 3 4 4 5 5]) (repeat 10 [2 3 4 5]) [2 3 3] (repeat 33 6)]))
frustrated-talk (utils/make-anim "ego/frustrated-talk.png" [16 36] 0.2 (flatten (range 6)))
swing-shovel (utils/make-anim "ego/swing-shovel.png" [70 70] 0.1 (range 9))
love (utils/make-anim-seq "ego/love" [50 70] 0.1 (flatten [0 0 1 1 2 2 3 3 4 4 5 5 6 6 (repeat 10 7) (repeat 5 8) (repeat 5 7) (repeat 5 8) (repeat 5 7) (repeat 10 [23 24 25 24]) (repeat 30 9) 10 11 12 13 14 15 16 17 18 19 20 21 21 21 22 22 22 21 21 21 21 21 21 21 21 22 22 22 22 22 21 21 21 21 22 22 22 22 22 22 21 21 21 21 21 6 6 5 5 4 4 3 3 2 2 1 1 0]))
whistle (utils/make-anim-seq "ego/whistle" [18 36] 0.2 (flatten [0 1 1 (repeat 200 [2 3])]))
axe (utils/make-anim "ego/axe.png" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 7)]))
axe-wood (utils/make-anim "ego/axe-wood.png" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 11)]))
suspended (utils/make-anim "ego/suspended.png" [20 36] 0.10 [0])
suspended-talk (utils/make-anim "ego/suspended.png" [20 36] 0.20 (range 7))
crawl (utils/make-anim "ego/crawl.png" [39 25] 0.2 (range 4))
crawl-stand (utils/make-anim "ego/crawl.png" [39 25] 0.2 [0])
crawl-hide (utils/make-anim "ego/crawl.png" [39 25] 0.1 (flatten [(repeat 10 3) (range 4 7) (repeat 50 6) (reverse (range 4 7) ) (repeat 20 3)]))
standup (utils/make-anim "ego/standup.png" [45 55] 0.2 (range 5))
hand-hold (utils/make-anim "ego/hand-hold.png" [18 36] 0.2 [0 1])
squat-talk (utils/make-anim global-atlas "ego/squat-talk" [18 36] 0.2 [0 1 0 2 1 0 3])
frog (utils/make-anim global-atlas "ego/frog" [16 36] 0.1 [0])
frog-nod (utils/make-anim global-atlas "ego/frog" [16 36] 0.2 [0 1 0 1 0 1 0 1])
hold-up-to-window (utils/make-anim global-atlas "ego/hold-up-to-window" [18 36] 0.1 [0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 0 0 0 0 0 0])
jump (utils/make-anim global-atlas "ego/swing" [36 75] 0.2 (flatten [[1 2]]))
jump-straight (utils/make-anim global-atlas "ego/jump-straight" [18 48] 0.075 [0 1 1 1 1 1 1 2 3])
climb (utils/make-anim global-atlas "ego/climb" [22 46] 0.3 [0 1 3 2 4 3 2 4 3 5 6 5 6 5 6 5 6 5 6 7 8 7 8 9 10 9 10 10 10 10 10 8 8 6 6 1 0])
poke (utils/make-anim global-atlas "ego/poke" [20 50] 0.2 [0 1 2 3 2 3 2 3 2 3 1 0])
jumping-straight (utils/make-anim global-atlas "ego/jump-straight" [18 48] 0.075 (repeat 30 4))
swing (utils/make-anim global-atlas "ego/swing" [36 75] 0.145 (flatten [[3 4 5 6 7 ]]))
grow-talk (utils/make-anim global-atlas "ego/grow-talk" [18 36] 0.2 (range 2))
get-sick (utils/make-anim global-atlas "ego/get-sick" [18 36] 0.1 (flatten [(range 6) (repeat 10 5) (reverse (range 6) ) 0 0 0 0 0 0]))
spear (utils/make-anim global-atlas "ego/spear" [18 100] 0.2 [0 1 2 3 2 3 2 3 2 3 2 1 0])
crowbar (utils/make-anim global-atlas "ego/crowbar" [36 36] 0.1 [0 0 0 1 1 2 2 2 2 2 3 2 3 2 3 2 3 2 3 3 3 1 1 0 0 0])
shoot (utils/make-anim global-atlas "ego/shoot" [24 36] 0.075 [0 0 0 1 1 2 2 2 2 2 2 2 2 3 4 5 4])
pant (utils/make-anim global-atlas "ego/pant" [31 36] 0.5 [0 1])
shock (utils/make-anim global-atlas "ego/shock" [40 48] 0.075 (flatten (repeat 2 [(repeat 5 [0 1 2]) (repeat 5 [3 4 5]) (repeat 5 [6 7 8])])))
burnt (utils/make-anim global-atlas "ego/burnt" [40 46] 0.12 [1 2 3 2 1 2 3 2 1 0 2 0 4 5 6 7 8 9 10 11 10 9 10 11])
passed-out (utils/make-anim global-atlas "ego/burnt" [40 46] 0.12 [9 10 11 10])
scared (utils/make-anim global-atlas "ego/scared" [18 36] 0.05 [0 1])
scared-talk (utils/make-anim global-atlas "ego/scared" [18 36] 0.05 [0 1 0 1 0 1 0 1 2 3 2 3 2 3 2 3])
scared-walk (utils/make-anim global-atlas "ego/scared-walk" [16 36] 0.05 (range 6))
sigh (utils/make-anim global-atlas "ego/sigh" [18 36] 0.08 [0 0 0 0 1 1 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 0 0 0 0 ])
glad (utils/make-anim global-atlas "ego/glad" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 8 [5 5 5]) (repeat 20 0)]))
milk (utils/make-anim global-atlas "ego/squat" [18 36] 0.05 [0 1 2 2 3 3 3 3 3 3 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 3 3 3 3 3 3 3 3 3 3 3 2 1 0])
idea (utils/make-anim global-atlas "ego/idea" [18 70] 0.3 [2 0 0 0 0 0 0 2])
throw (utils/make-anim global-atlas "ego/throw" [18 36] 0.04 (flatten [[(repeat 5 0) (repeat 10 1)] (repeat 3 [2 2 2 3 3 3 4 4 4 5 5 5]) (repeat 5 [2 2 3 3 4 4 5 5]) (repeat 10 [2 3 4 5]) [2 3 3] (repeat 33 6)]))
frustrated-talk (utils/make-anim global-atlas "ego/frustrated-talk" [16 36] 0.2 (flatten (range 6)))
swing-shovel (utils/make-anim global-atlas "ego/swing-shovel" [70 70] 0.1 (range 9))
love (utils/make-anim-seq global-atlas "ego/love" [50 70] 0.1 (flatten [0 0 1 1 2 2 3 3 4 4 5 5 6 6 (repeat 10 7) (repeat 5 8) (repeat 5 7) (repeat 5 8) (repeat 5 7) (repeat 10 [23 24 25 24]) (repeat 30 9) 10 11 12 13 14 15 16 17 18 19 20 21 21 21 22 22 22 21 21 21 21 21 21 21 21 22 22 22 22 22 21 21 21 21 22 22 22 22 22 22 21 21 21 21 21 6 6 5 5 4 4 3 3 2 2 1 1 0]))
whistle (utils/make-anim-seq global-atlas "ego/whistle" [18 36] 0.2 (flatten [0 1 1 (repeat 200 [2 3])]))
axe (utils/make-anim global-atlas "ego/axe" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 7)]))
axe-wood (utils/make-anim global-atlas "ego/axe-wood" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 11)]))
suspended (utils/make-anim global-atlas "ego/suspended" [20 36] 0.10 [0])
suspended-talk (utils/make-anim global-atlas "ego/suspended" [20 36] 0.20 (range 7))
crawl (utils/make-anim global-atlas "ego/crawl" [39 25] 0.2 (range 4))
crawl-stand (utils/make-anim global-atlas "ego/crawl" [39 25] 0.2 [0])
crawl-hide (utils/make-anim global-atlas "ego/crawl" [39 25] 0.1 (flatten [(repeat 10 3) (range 4 7) (repeat 50 6) (reverse (range 4 7) ) (repeat 20 3)]))
standup (utils/make-anim global-atlas "ego/standup" [45 55] 0.2 (range 5))
hand-hold (utils/make-anim global-atlas "ego/hand-hold" [18 36] 0.2 [0 1])
choose-step-sound (fn [entities]
(if (#{:inside-house :inside-stash :inside-cafeteria :inside-antique :inside-jail}
(get-in entities [:state :last-room]))
@@ -1299,7 +1299,7 @@
:started? {:value false
:object nil}
:room (as-> (get rooms (:last-room state)) room
(assoc-in room [:entities :ego] (get-ego screen (if has-start-pos?
(assoc-in room [:entities :ego] (get-ego screen global-atlas (if has-start-pos?
start-pos
(:start-pos room))
((:scale-fn room)