screens can load their resources
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -2,7 +2,7 @@
|
||||
(def packs (into ["do"]
|
||||
(mapcat (fn [directory]
|
||||
["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" (str "asset-work/" directory) "resources/packed/" (str directory ",")])
|
||||
["global"]
|
||||
["outsidehouse"]
|
||||
#_["behindhouse" "dream" "georgia" "inside-cafeteria" "inside-jail" "outsidehouse" "safe-song" "title"
|
||||
"castle-gate" "ego" "held" "inside-castle" "inside-stash" "outside-castle" "screenshots" "wizard"
|
||||
"cat-tree" "ending-castle" "inside-antique" "inside-house" "outside-jail" "space" ])))
|
||||
@@ -10,7 +10,6 @@
|
||||
;; castle-gate/ ego/ held/ inside-castle/ inside-stash/ outside-castle/ right.pxa/ screenshots/ wizard/
|
||||
;; cat-tree/ ending-castle/ inside-antique/ inside-house/ left.pxa/ outside-jail/ safe-song.pxa/ space/
|
||||
|
||||
(println packs)
|
||||
|
||||
(defproject advent "2.0.5-SNAPSHOT"
|
||||
:description "FIXME: write description"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
outsidehouse.png
|
||||
size: 1024,1024
|
||||
format: RGBA8888
|
||||
format: RGBA4444
|
||||
filter: Nearest,Nearest
|
||||
repeat: none
|
||||
background
|
||||
@@ -25,34 +25,34 @@ cauldron
|
||||
orig: 200, 38
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
charcoal-1
|
||||
charcoal
|
||||
rotate: false
|
||||
xy: 132, 110
|
||||
size: 24, 18
|
||||
orig: 24, 18
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
charcoal-2
|
||||
index: 0
|
||||
charcoal
|
||||
rotate: false
|
||||
xy: 646, 586
|
||||
size: 24, 18
|
||||
orig: 24, 18
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
charcoal-3
|
||||
index: 1
|
||||
charcoal
|
||||
rotate: false
|
||||
xy: 744, 646
|
||||
size: 24, 18
|
||||
orig: 24, 18
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
charcoal-4
|
||||
index: 2
|
||||
charcoal
|
||||
rotate: false
|
||||
xy: 324, 344
|
||||
size: 24, 18
|
||||
orig: 24, 18
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
index: 3
|
||||
door
|
||||
rotate: false
|
||||
xy: 646, 606
|
||||
|
||||
@@ -280,7 +280,8 @@
|
||||
(defn play-animation [entities target-id anim & {:keys [stop? continue? next]}]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
(update-in entities [:room :entities target-id] #(start-animation screen % anim) ))
|
||||
(update-in entities [:room :entities target-id] #(doto (start-animation screen % anim)
|
||||
println) ))
|
||||
|
||||
(continue [this screen entities] entities)
|
||||
|
||||
@@ -677,7 +678,8 @@
|
||||
(defn transition-background [entities new-background [x y] & {:keys [transition-music? between time face]}]
|
||||
(let [transition-music? (if (nil? transition-music?) true transition-music?)
|
||||
old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time]))
|
||||
new-music (get-music (get-in @entities [:rooms new-background :music]) (get-in @entities [:state :time]))
|
||||
;; TODO FIX
|
||||
new-music old-music
|
||||
music-changed? (and transition-music? (not= old-music new-music))
|
||||
time (/ (float (or time 1.0)) 2.0)]
|
||||
(run-action entities
|
||||
@@ -720,7 +722,7 @@
|
||||
(let [ego (get-in entities [:room :entities :ego])
|
||||
old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
|
||||
entities (as-> entities e
|
||||
(assoc-in e [:room] (get-in entities [:rooms new-background]))
|
||||
(assoc-in e [:room] ((get-in entities [:rooms new-background]) screen))
|
||||
(assoc-in e [:room :entities :ego] ego)
|
||||
(assoc-in e [:current-sounds :value] [])
|
||||
(if between (between screen e) e)
|
||||
|
||||
@@ -194,9 +194,7 @@
|
||||
(particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :reset)
|
||||
(particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :start)
|
||||
(Thread/sleep 1500)
|
||||
(actions/transition-background entities :outside-house [257 90] :face :left)
|
||||
(dotimes [_ 160]
|
||||
(particle-effect! (get-in @entities [:rooms :inside-house :entities :magic-frog-particle]) :update 0.2)))
|
||||
(actions/transition-background entities :outside-house [257 90] :face :left))
|
||||
|
||||
(defn do-prophecy [entities]
|
||||
{:run #(do (actions/respond entities %
|
||||
@@ -605,20 +603,21 @@
|
||||
|
||||
|
||||
(defn make [screen]
|
||||
(let [sheep-stand-sheet (texture! (utils/get-texture "outsidehouse/sheep-anim.png") :split 33 21)
|
||||
sheep-walk-sheet (texture! (utils/get-texture "outsidehouse/sheep-walk.png") :split 33 21)
|
||||
lamb-walk-sheet (texture! (utils/get-texture "outsidehouse/lamb-walk.png") :split 27 28)
|
||||
(let [[screen atlas] (utils/acquire-atlas screen "packed/outsidehouse.atlas")
|
||||
sheep-stand-sheet (texture! (utils/atlas->texture atlas "sheep-anim") :split 33 21)
|
||||
sheep-walk-sheet (texture! (utils/atlas->texture atlas "sheep-walk") :split 33 21)
|
||||
lamb-walk-sheet (texture! (utils/atlas->texture atlas "lamb-walk") :split 27 28)
|
||||
sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 11) (repeat 15 12)])]
|
||||
(aget sheep-stand-sheet 0 i)))
|
||||
sheep-1 (utils/make-anim "outsidehouse/sheep-1.png" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
|
||||
sheep-2 (utils/make-anim "outsidehouse/sheep-2.png" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
|
||||
sheep-3 (utils/make-anim "outsidehouse/sheep-3.png" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
|
||||
door (utils/make-anim "outsidehouse/door.png" [24 58] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
|
||||
sheep-1 (utils/make-anim atlas "sheep-1" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
|
||||
sheep-2 (utils/make-anim atlas "sheep-2" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
|
||||
sheep-3 (utils/make-anim atlas "sheep-3" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
|
||||
door (utils/make-anim atlas "door" [24 58] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
|
||||
sheep-walk (animation 0.05 (for [i (range 6)]
|
||||
(aget sheep-walk-sheet 0 i)))
|
||||
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
|
||||
cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4))
|
||||
charcoal (utils/make-anim-seq "outsidehouse/charcoal" [24 18] 0.25 (range 4))
|
||||
cauldron (utils/make-anim atlas "cauldron" [50 38] 0.15 (range 4))
|
||||
charcoal (utils/make-anim-seq atlas "charcoal" [24 18] 0.25 (range 4))
|
||||
scaler (utils/scaler-fn-with-baseline 110 0.10 1.00)
|
||||
lamb-stand (aget lamb-walk-sheet 0 0)
|
||||
lamb-walk (animation 0.075 (for [i (range 4)]
|
||||
@@ -792,7 +791,7 @@
|
||||
:y 105
|
||||
:baseline 238)
|
||||
:door (assoc (animation->texture screen door)
|
||||
:x 252 :y 88 :baseline 122
|
||||
:x 252 :y 88 :baseline 123
|
||||
:open door
|
||||
:door-sound (utils/load-sound "door.ogg")
|
||||
:anim-sound-frames {door {1 [:door-sound 0.1]}}
|
||||
|
||||
@@ -858,6 +858,8 @@
|
||||
(if anim-loop?
|
||||
(get-looped-animation-point anim last-animated-time)
|
||||
last-animated-time))]
|
||||
|
||||
|
||||
(if (and (= current-frame-index (:current-frame-index entity) (:previous-frame-index entity))
|
||||
(not (:force-rerender entity)))
|
||||
entity
|
||||
@@ -1206,23 +1208,24 @@
|
||||
|
||||
_ (update! screen :shader shader)
|
||||
log-assets (fn [r] r)
|
||||
rooms {:inside-house (rooms.inside-house/make screen)
|
||||
:inside-stash (rooms.inside-stash/make screen)
|
||||
:outside-house (rooms.outside-house/make screen)
|
||||
:behind-house (rooms.behind-house/make screen)
|
||||
:cat-tree (rooms.cat-tree/make screen)
|
||||
:inside-castle (rooms.inside-castle/make screen)
|
||||
:space (rooms.space/make screen)
|
||||
:held (rooms.held/make screen)
|
||||
:inside-cafeteria (rooms.inside-cafeteria/make screen)
|
||||
:inside-antique (rooms.inside-antique/make screen)
|
||||
:inside-jail (rooms.inside-jail/make screen)
|
||||
:dream (rooms.dream/make screen)
|
||||
:ending (rooms.ending/make screen)
|
||||
:castle-gate (rooms.castle-gate/make screen)
|
||||
:outside-jail (rooms.outside-jail/make screen)
|
||||
:outside-castle (rooms.outside-castle/make screen)}
|
||||
rooms (add-georgia-to-all-rooms screen rooms)
|
||||
rooms {:inside-house rooms.inside-house/make
|
||||
:inside-stash rooms.inside-stash/make
|
||||
:outside-house rooms.outside-house/make
|
||||
:behind-house rooms.behind-house/make
|
||||
:cat-tree rooms.cat-tree/make
|
||||
:inside-castle rooms.inside-castle/make
|
||||
:space rooms.space/make
|
||||
:held rooms.held/make
|
||||
:inside-cafeteria rooms.inside-cafeteria/make
|
||||
:inside-antique rooms.inside-antique/make
|
||||
:inside-jail rooms.inside-jail/make
|
||||
:dream rooms.dream/make
|
||||
:ending rooms.ending/make
|
||||
:castle-gate rooms.castle-gate/make
|
||||
:outside-jail rooms.outside-jail/make
|
||||
:outside-castle rooms.outside-castle/make }
|
||||
;; TODO RE ADD
|
||||
#_#_rooms (add-georgia-to-all-rooms screen rooms)
|
||||
entities {:rooms rooms
|
||||
:step-particles (assoc (particle-effect "particles/step") :x 100 :y 100 :baseline 241)
|
||||
:cam {:zoom utils/min-zoom
|
||||
@@ -1298,7 +1301,7 @@
|
||||
:all-items (assoc items/items :object nil)
|
||||
:started? {:value false
|
||||
:object nil}
|
||||
:room (as-> (get rooms (:last-room state)) room
|
||||
:room (as-> ((get rooms (:last-room state)) screen) room
|
||||
(assoc-in room [:entities :ego] (get-ego screen global-atlas (if has-start-pos?
|
||||
start-pos
|
||||
(:start-pos room))
|
||||
|
||||
Reference in New Issue
Block a user