more detail on the screen.
This commit is contained in:
BIN
desktop/resources/butterfly.png
Normal file
BIN
desktop/resources/butterfly.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
desktop/resources/outside-castle/flies.png
Normal file
BIN
desktop/resources/outside-castle/flies.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -7,6 +7,7 @@
|
|||||||
[play-clj.core :refer :all]
|
[play-clj.core :refer :all]
|
||||||
[play-clj.ui :refer :all]
|
[play-clj.ui :refer :all]
|
||||||
[play-clj.utils :refer :all]
|
[play-clj.utils :refer :all]
|
||||||
|
[play-clj.math :refer :all]
|
||||||
[play-clj.g2d :refer :all]))
|
[play-clj.g2d :refer :all]))
|
||||||
|
|
||||||
(defn make [screen]
|
(defn make [screen]
|
||||||
@@ -18,11 +19,18 @@
|
|||||||
balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36)
|
balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36)
|
||||||
balloon-stand (animation 0.3 (for [i [0 1 2 1]]
|
balloon-stand (animation 0.3 (for [i [0 1 2 1]]
|
||||||
(aget balloon-sheet 0 i)))
|
(aget balloon-sheet 0 i)))
|
||||||
bird-sheet (texture! (texture "outside-castle/bird.png") :split 60 22)
|
bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2)
|
||||||
bird-order [0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]
|
bird-stand (animation 0.15 (for [i [0 1]]
|
||||||
bird-stand (animation 0.15 (for [i (concat bird-order
|
|
||||||
(reverse bird-order))]
|
|
||||||
(aget bird-sheet 0 i)))
|
(aget bird-sheet 0 i)))
|
||||||
|
butterfly-sheet (texture! (texture "butterfly.png") :split 7 7)
|
||||||
|
butterfly-stand (animation 0.1 (for [i [0 1]]
|
||||||
|
(aget butterfly-sheet 0 i)))
|
||||||
|
steer-sheet (texture! (texture "outside-castle/steer.png") :split 50 35)
|
||||||
|
steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]]
|
||||||
|
(aget steer-sheet 0 i)))
|
||||||
|
flies-sheet (texture! (texture "outside-castle/flies.png") :split 15 15)
|
||||||
|
flies-stand (animation 0.075 (for [i [0 1 2 1]]
|
||||||
|
(aget flies-sheet 0 i)))
|
||||||
]
|
]
|
||||||
(rooms/make :music :town-2
|
(rooms/make :music :town-2
|
||||||
:interactions
|
:interactions
|
||||||
@@ -133,15 +141,19 @@
|
|||||||
(assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil
|
(assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil
|
||||||
:talk peddler-talk :stand peddler-stand)
|
:talk peddler-talk :stand peddler-stand)
|
||||||
:stand)
|
:stand)
|
||||||
:steer (assoc (texture "outside-castle/steer.png" ) :x 203 :y 155 :baseline 80
|
:steer (actions/start-animation screen (assoc (animation->texture screen steer-stand) :x 203 :y 155 :baseline 80
|
||||||
:script (actions/get-script entities
|
:stand steer-stand
|
||||||
(actions/talk entities :ego "That is one buff bull!"))
|
:script (actions/get-script entities
|
||||||
:scripts {:grass (actions/get-script entities
|
(actions/do-dialogue entities
|
||||||
(actions/walk-to entities :ego [168 150] :face :right)
|
:ego "It's Angus, Remington's buff bull."
|
||||||
(actions/play-animation entities :ego :reach)
|
:ego "Farmer doug feeds him a special grass diet to keep him in tip top shape."))
|
||||||
(actions/remove-item entities :grass)
|
:scripts {:grass (actions/get-script entities
|
||||||
(actions/talk entities :ego "Eww! He slobbered on my hand.")
|
(actions/walk-to entities :ego [168 150] :face :right)
|
||||||
(actions/give entities :slobber))})
|
(actions/play-animation entities :ego :reach)
|
||||||
|
(actions/remove-item entities :grass)
|
||||||
|
(actions/talk entities :ego "Eww! He slobbered on my hand.")
|
||||||
|
(actions/give entities :slobber))})
|
||||||
|
:stand)
|
||||||
:balloons (actions/start-animation screen
|
:balloons (actions/start-animation screen
|
||||||
(assoc (animation->texture screen balloon-stand)
|
(assoc (animation->texture screen balloon-stand)
|
||||||
:x 75
|
:x 75
|
||||||
@@ -153,10 +165,40 @@
|
|||||||
:stand)
|
:stand)
|
||||||
:bird (actions/start-animation screen
|
:bird (actions/start-animation screen
|
||||||
(assoc (animation->texture screen bird-stand)
|
(assoc (animation->texture screen bird-stand)
|
||||||
|
:x 0
|
||||||
|
:y 0
|
||||||
|
:baseline 21
|
||||||
|
:stand bird-stand
|
||||||
|
:path (catmull-rom-spline (map #(apply vector-2* %) (as-> [[82 235] [134 215] [185 235] [165 238]
|
||||||
|
[220 225] [210 230] [250 235]] p
|
||||||
|
(concat p (reverse p)))) true)
|
||||||
|
:update-fn (fn [screen entities entity]
|
||||||
|
(let [speed 0.05
|
||||||
|
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
|
||||||
|
v (vector-2 0 0)
|
||||||
|
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
|
||||||
|
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))
|
||||||
|
:stand)
|
||||||
|
:butterfly (actions/start-animation screen
|
||||||
|
(assoc (animation->texture screen butterfly-stand)
|
||||||
:x 161
|
:x 161
|
||||||
:y 218
|
:y 218
|
||||||
:baseline 21
|
:baseline 240
|
||||||
:stand bird-stand)
|
:stand butterfly-stand
|
||||||
|
:path (catmull-rom-spline (map #(apply vector-2* %) (take 10 (repeatedly #(vector (rand-int 320) (rand-int 180))))) true)
|
||||||
|
:update-fn (fn [screen entities entity]
|
||||||
|
(let [speed 0.009
|
||||||
|
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
|
||||||
|
v (vector-2 0 0)
|
||||||
|
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
|
||||||
|
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))
|
||||||
|
:stand)
|
||||||
|
:flies (actions/start-animation screen
|
||||||
|
(assoc (animation->texture screen flies-stand)
|
||||||
|
:x 241
|
||||||
|
:y 175
|
||||||
|
:baseline 240
|
||||||
|
:stand flies-stand)
|
||||||
:stand)}
|
:stand)}
|
||||||
:collision "outside-castle/collision.png"
|
:collision "outside-castle/collision.png"
|
||||||
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
|
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
|
||||||
|
|||||||
@@ -273,6 +273,12 @@
|
|||||||
(if (:anim entity)
|
(if (:anim entity)
|
||||||
[id (animate entity screen)]
|
[id (animate entity screen)]
|
||||||
[id entity])))))
|
[id entity])))))
|
||||||
|
entities (update-in entities [:room :entities] (fn [entities]
|
||||||
|
(into entities
|
||||||
|
(for [[id entity] entities]
|
||||||
|
(if (:update-fn entity)
|
||||||
|
[id ((:update-fn entity) screen entities entity)]
|
||||||
|
[id entity])))))
|
||||||
all-entities (concat (vals entities) (get-in entities [:room :layers]) (vals (get-in entities [:room :entities])))]
|
all-entities (concat (vals entities) (get-in entities [:room :layers]) (vals (get-in entities [:room :entities])))]
|
||||||
(label! (:fps entities) :set-text (str (game :fps)))
|
(label! (:fps entities) :set-text (str (game :fps)))
|
||||||
(render! screen (sort-by :baseline all-entities))
|
(render! screen (sort-by :baseline all-entities))
|
||||||
|
|||||||
Reference in New Issue
Block a user