working on texture packing

This commit is contained in:
Bryce Covert
2015-09-12 00:28:35 -07:00
parent e2f08801b3
commit 10ea484ea2
46 changed files with 6161 additions and 30 deletions

View File

@@ -720,7 +720,7 @@
(-> entities
(update-in [:room :entities :ego] #(actions/start-animation screen % :glad) )
(assoc-in [:tweens :jump] (tween/tween :jump screen [:room :entities :ego :y] current-y to-y 0.3 :ease tween/ease-out-cubic))
(assoc-in [:room :entities :glad-jump] (doto (assoc (particle-effect "ego/glad-jump")
(assoc-in [:room :entities :glad-jump] (doto (assoc (particle-effect "particles/glad-jump")
:x (get-in entities [:room :entities :ego :x])
:y (get-in entities [:room :entities :ego :y])
:baseline (get-in entities [:room :entities :ego :baseline]))

View File

@@ -93,7 +93,7 @@
offset-y (+ y (/ item-width 2))
padding (/ item-width 2)
padding (* 4 padding)]]
(assoc (utils/get-texture (aget (:all-items entities) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
(assoc (texture (aget (:all-items entities) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
:x x :y y
:scale-x 4
:scale-y 4

View File

@@ -225,7 +225,7 @@
owl-stand (utils/make-anim "cat-tree/owl.png" [19 28] 0.2 [0 0 0 0 0 0 0 2])
owl-talk (utils/make-anim "cat-tree/owl.png" [19 28] 0.2 [1 0 1 0 1 0 0 0 2 0])
owl-puke (utils/make-anim "cat-tree/owl.png" [19 28] 0.10 [0 0 2 2 3 2 2 3 3 2 3 3 3 4 5 6 7 4 4 3 3 2 2 2 2 2])
puke (particle-effect "cat-tree/puke")]
puke (particle-effect "particles/puke")]
(rooms/make :music {:day :town-2 :night :night}
:ladder ladder-entity
:blank (rooms/make-entity :blank

View File

@@ -428,7 +428,7 @@
(defn make-outside-particles []
(doto (assoc (particle-effect "outside-particles") :x 160 :y 120
(doto (assoc (particle-effect "particles/outside-particles") :x 160 :y 120
:baseline 238)
(particle-effect! :set-position 160 120)))

View File

@@ -376,9 +376,9 @@
(assoc (utils/get-texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)]
:wind-sound {:sound (sound "dream/wind.ogg")
:id nil}
:entities {:magic (assoc (particle-effect "dream/magic") :x 160 :y 80 :baseline 240)
:entities {:magic (assoc (particle-effect "particles/dream-magic") :x 160 :y 80 :baseline 240)
:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241)
:clouds (assoc (particle-effect "particles/cloudy2") :x 160 :y 120 :baseline 241)
:case (assoc (utils/get-texture "dream/case.png")
:x 144 :y 122 :baseline 139
:script (actions/get-script entities
@@ -419,7 +419,7 @@
:sword (assoc (utils/get-texture "dream/sword.png")
:x 144 :y 122 :baseline 139)
:explode (assoc (particle-effect "dream/explode") :x 150 :y 138 :baseline 240)
:explode (assoc (particle-effect "particles/explode") :x 150 :y 138 :baseline 240)
:broom (assoc (utils/get-texture "dream/broom.png") :x 286 :y 122
:path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true)

View File

@@ -57,7 +57,7 @@
:update-fn (fn [screen entities gandarf]
(assoc gandarf :y (or (get-in entities [:gandarf-cloud :y])
(:y gandarf)))))
:gandarf-cloud (doto (assoc (particle-effect "wizard/gandarf-cloud") :x 215 :y 400
:gandarf-cloud (doto (assoc (particle-effect "particles/gandarf-cloud") :x 215 :y 400
:baseline 200)
(particle-effect! :set-position 215 130))
:duke (assoc (animation->texture screen duke-stand)
@@ -70,7 +70,7 @@
:reach duke-reach
:reach-talk duke-reach-talk
:knight duke-knight)
:magic-frog-particle (doto (assoc (particle-effect "inside-house/magic-frog") :x 140 :y 49
:magic-frog-particle (doto (assoc (particle-effect "particles/magic-frog") :x 140 :y 49
:baseline 241)
(particle-effect! :set-position 150 49))
:ladder-guard-1 (assoc (animation->texture screen ladder-guard-stand-1)

View File

@@ -309,10 +309,10 @@
:x 70
:y 86
:baseline 120)
:smoke-particle (doto (assoc (particle-effect "inside-antique/smoke-particle") :x 162 :y 108
:smoke-particle (doto (assoc (particle-effect "particles/smoke-particle") :x 162 :y 108
:baseline 240)
(particle-effect! :set-position 162 108))
:fire-particle (doto (assoc (particle-effect "inside-antique/fire-particle") :x 162 :y 108
:fire-particle (doto (assoc (particle-effect "particles/fire-particle") :x 162 :y 108
:baseline 240)
(particle-effect! :set-position 162 108))
:bowl (assoc (utils/get-texture "inside-antique/bowl.png")

View File

@@ -456,7 +456,7 @@
entities
(nil? magic)
(do
(assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "inside-castle/magic")
(assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "particles/magic")
(particle-effect! :reset))
:x 25
:y 108

View File

@@ -133,9 +133,9 @@
(let [safelock-sheet (texture! (utils/get-texture "inside-house/safe-lock.png") :split 9 2)
safe-lock (animation 0.1 (for [i (flatten [(repeat 20 0) 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 (range 3 20) 20 20 20 20 21 21 21 21 21 20 20 21 21 21 21 21 20 20 20 ])]
(aget safelock-sheet 0 i)))
candle (utils/make-anim (utils/get-texture "inside-house/candle.png") [34 32] 0.2 [1 0 1 2])
candle-aura (utils/make-anim (utils/get-texture "inside-house/candle-aura.png") [27 27] 0.2 [0 1 2 3 2 1] )
experiment-left (utils/flip (utils/make-anim (utils/get-texture "wizard/experiment.png" ) [45 55] 0.075 [0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 3 3 3 4 4 5 5 6 6 6 6 6 6 7 8 9 9 10 10 11 11 12 12 12 12 12 12 12 12 12 12 12 13 13 14 14 14 14 14 15 15 16 16 17 17 18 18 18 18 19 20 21 21 21 21 21 21 22 23 22 23 22 23 22 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 25 26 27 37 38 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 29 29 28 28 28 28 29 29 28 28 28 28 28 28 28 28 30 30 30 30 31 32 33 31 31 31 31 31 31 31 31 34 35 36 36 36 36 36 36 36 36 36] ))]
candle (utils/make-anim "inside-house/candle.png" [34 32] 0.2 [1 0 1 2])
candle-aura (utils/make-anim "inside-house/candle-aura.png" [27 27] 0.2 [0 1 2 3 2 1] )
experiment-left (utils/flip (utils/make-anim "wizard/experiment.png" [45 55] 0.075 [0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 3 3 3 4 4 5 5 6 6 6 6 6 6 7 8 9 9 10 10 11 11 12 12 12 12 12 12 12 12 12 12 12 13 13 14 14 14 14 14 15 15 16 16 17 17 18 18 18 18 19 20 21 21 21 21 21 21 22 23 22 23 22 23 22 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 25 26 27 37 38 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 29 29 28 28 28 28 29 29 28 28 28 28 28 28 28 28 30 30 30 30 31 32 33 31 31 31 31 31 31 31 31 34 35 36 36 36 36 36 36 36 36 36] ))]
(rooms/make :music :inside-fangald
:interactions {:down-dir {:box [151 0 320 40]
:script (actions/get-script entities
@@ -205,10 +205,10 @@
:anim-start 0
:script (actions/get-script entities (actions/do-dialogue entities :ego "It's just a candle.")))
:candle-aura (assoc (animation->texture screen candle-aura) :x 172 :y 97 :baseline 239 :additive? true :origin-x 13 :opacity 0.5 :anim candle-aura :anim-start 0)
:candle-smoke (doto (assoc (particle-effect "inside-house/candle") :x 172 :y 112
:candle-smoke (doto (assoc (particle-effect "particles/candle") :x 172 :y 112
:baseline 200)
(particle-effect! :set-position 172 112))
:magic-frog-particle (doto (assoc (particle-effect "inside-house/magic-frog") :x 230 :y 0
:magic-frog-particle (doto (assoc (particle-effect "particles/magic-frog") :x 230 :y 0
:baseline 241)
(particle-effect! :set-position 237 0))
:flask (assoc (utils/get-texture "inside-house/flask.png")

View File

@@ -219,7 +219,7 @@
warden-sleep (animation 0.25 (for [i (flatten [ 3 4 3 4 3 4 3 4 3 4 5 5 2 2 2 2 2 2])]
(aget warden-sheet 0 i)))
candle (utils/make-anim "inside-jail/candle.png" [20 25] 0.1 (range 4))
candle-aura (utils/make-anim (utils/get-texture "inside-house/candle-aura.png") [27 27] 0.2 [0 1 2 3 2 1])]
candle-aura (utils/make-anim "inside-house/candle-aura.png" [27 27] 0.2 [0 1 2 3 2 1])]
(rooms/make :music :inside-antique
:interactions {
:lock {:box [172 102 190 124]
@@ -393,7 +393,7 @@
:additive? true :origin-x 13 :origin-y 13 :opacity 0.5 :anim candle-aura :anim-start 0 :night-profile :none
:script (actions/get-script entities (actions/talk entities :ego "Just a candle."))
:scripts {:default (actions/get-script entities (actions/talk entities :ego "I might catch the place on fire."))})
:candle-smoke (doto (assoc (particle-effect "inside-jail/candle") :x 215 :y 130
:candle-smoke (doto (assoc (particle-effect "particles/candle") :x 215 :y 130
:baseline 200)
(particle-effect! :set-position 215 130))
:crowbar (assoc (utils/get-texture "inside-jail/crowbar.png")

View File

@@ -49,7 +49,7 @@
(defn make [screen]
(let [candle-flame (utils/make-anim "inside-stash/candle.png" [4 4] 0.1 (range 4))
candle-aura (utils/make-anim (utils/get-texture "inside-house/candle-aura.png") [27 27] 0.2 [0 1 2 3 2 1] )
candle-aura (utils/make-anim "inside-house/candle-aura.png" [27 27] 0.2 [0 1 2 3 2 1] )
]
(rooms/make :music {:day :secret-hideout :night :secret-hideout}
:interactions

View File

@@ -709,7 +709,7 @@
sheep-stand)
:outside-particles (common/make-outside-particles)
:magic (assoc (doto (particle-effect "outsidehouse/magic") )
:magic (assoc (doto (particle-effect "particles/magic") )
:x 153
:y 105
:baseline 238)

View File

@@ -104,7 +104,7 @@
open-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (reverse (range 5)))
close-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (range 5))
candle-flame (utils/make-anim "outside-jail/candle.png" [20 25] 0.075 (range 4))
candle-aura (utils/make-anim (utils/get-texture "outside-jail/candle-aura2.png") [135 135] 0.3 [0 1 2 1] )]
candle-aura (utils/make-anim "outside-jail/candle-aura2.png" [135 135] 0.3 [0 1 2 1] )]
(rooms/make :music {:day :town-1 :night :night}
:interactions {:down-dir {:box [30 0 227 40]
:script (actions/get-script entities
@@ -234,7 +234,7 @@
:anim-start 0)
:candle-aura (assoc (animation->texture screen candle-aura) :x 14 :y 82 :baseline 240
:additive? true :origin-x 67 :origin-y 67 :scale-x 1 :scale-y 1 :opacity 0.5 :anim candle-aura :anim-start 0 :night-profile :none)
:fountain-particle (assoc (doto (particle-effect "outside-jail/fountain")
:fountain-particle (assoc (doto (particle-effect "particles/fountain")
(particle-effect! :reset)
(particle-effect! :start))
:x 172

View File

@@ -182,9 +182,9 @@
blergh-stand-anim (utils/make-anim "space/bloodclot-stand.png" [106 165] 0.75 [0 1])
bloodclot-explode (utils/make-anim "space/bloodclot-explode.png" [106 165] 0.075 [0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 4 4 4 4 5 5 5 5 5 4 4 4 4 5 5 4 4 4 4 5 5 5 4 5 5 5 5 5 5 5 5 6 5 5 5 5 6 6 5 5 5 5 5 5 5 6 6 6 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 6 7 7 5 6 6 6 6 6 7 7 7 7 6 6 6 6 6 6 6 6 6 6 7 7 7 7 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 10 11 12 13 14 15 16 17 18 19])
bullet (utils/make-anim "space/bullet.png" [24 24] 0.0075 [0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 3 3 3 4 4 5 5 6 5 4 7])
effect (particle-effect "space/appear")
blowup-effect (particle-effect "space/blowup")
grow-explode (particle-effect "space/grow-explode")]
effect (particle-effect "particles/appear")
blowup-effect (particle-effect "particles/blowup")
grow-explode (particle-effect "particles/grow-explode")]
(rooms/make :music :fight
:interactions
{}

View File

@@ -975,7 +975,7 @@ void main()
:outside-jail (rooms.outside-jail/make screen)
:outside-castle (rooms.outside-castle/make screen)}
entities {:rooms rooms
:step-particles (assoc (particle-effect "ego/step") :x 100 :y 100 :baseline 241)
:step-particles (assoc (particle-effect "particles/step") :x 100 :y 100 :baseline 241)
:cam {:zoom 0.95
:paused? false
:object nil}

View File

@@ -128,8 +128,8 @@
:balloon (assoc (animation->texture (assoc screen :total-time 0.0) balloon) :x 100 :y 100 :scale-x 4 :scale-y 4
:anim balloon
:path (catmull-rom-spline (map #(apply vector-2* %) [[50 50] [70 100] [100 200] [151 206] [300 225] [480 300] [560 400] [650 440] [700 550] [750 600] [860 650] [950 700] [1030 800] [1280 960] [1300 1000] [-50 1000] [-50 -50]]) true))
:particle-clouds (assoc (particle-effect "title/particle-clouds" :reset :start) :x 640 :y 480 )
:ego-jet (assoc (particle-effect "ego/jet" :reset :start) :x 450 :y 650 )
:particle-clouds (assoc (particle-effect "particles/particle-clouds" :reset :start) :x 640 :y 480 )
:ego-jet (assoc (particle-effect "particles/jet" :reset :start) :x 450 :y 650 )
:toolbox (center (assoc (nine-patch {:region (:object (utils/get-texture "talk-bg-2.png")) :left 9 :top 9 :right 9 :bottom 9})
:y 58 :width 500 :height 282))

View File

@@ -136,7 +136,7 @@
frame))))
(defn split-texture [file [w h] frames]
(let [sheet (texture! (texture file) :split w h)]
(let [sheet (texture! (get-texture file) :split w h)]
(for [i frames]
(aget sheet 0 i))))