better idle
This commit is contained in:
@@ -290,8 +290,7 @@
|
||||
(actions/play-animation entities :ego :squat)
|
||||
(actions/talk entities :ego "No one will notice one missing.")
|
||||
(actions/give entities :carrot))))}}
|
||||
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
|
||||
]
|
||||
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
|
||||
:night [(assoc (texture "outside-castle/background-dark.png") :x 0 :y 0 :baseline 0)]
|
||||
:sunrise [(assoc (texture "outside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]}
|
||||
:entities {:peddler (actions/start-animation screen
|
||||
|
||||
@@ -469,6 +469,26 @@
|
||||
(.end batch))))
|
||||
|
||||
|
||||
(defn shift-range-to-bounds [x1 x2 min max]
|
||||
(println x1 x2 "->" (cond (and (< x1 min)
|
||||
(> x2 max))
|
||||
[min max]
|
||||
(< x1 min)
|
||||
[min (+ x2 (- min x1))]
|
||||
(> x2 max)
|
||||
[(- x1 (- x2 max)) max]
|
||||
:else
|
||||
[x1 x2]))
|
||||
(cond (and (< x1 min)
|
||||
(> x2 max))
|
||||
[min max]
|
||||
(< x1 min)
|
||||
[min (+ x2 (- min x1))]
|
||||
(> x2 max)
|
||||
[(- x1 (- x2 max)) max]
|
||||
:else
|
||||
[x1 x2]))
|
||||
|
||||
(defscreen scene
|
||||
:on-timer
|
||||
(fn [screen [entities]]
|
||||
@@ -576,18 +596,25 @@
|
||||
[id entity])))))
|
||||
|
||||
entities (if (and (nil? (get-in entities [:tweens :cam-x]))
|
||||
(= 1 (rand-int 40)))
|
||||
(actions/pan-to screen entities
|
||||
(+ (get-in entities [:room :entities :ego :x])
|
||||
(- (rand-int 20) 10))
|
||||
(+ (get-in entities [:room :entities :ego :y])
|
||||
(- (rand-int 20) 10))
|
||||
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0)
|
||||
(= 1 (rand-int 20)))
|
||||
(if (= (rand-int 2) 1)
|
||||
(actions/pan-to screen entities
|
||||
(get-in entities [:room :entities :ego :x])
|
||||
(get-in entities [:room :entities :ego :y])
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0)
|
||||
(actions/pan-to screen entities
|
||||
(+ (get-in entities [:cam :x] 0)
|
||||
(- 10 (rand-int 20)))
|
||||
(+ (get-in entities [:cam :y] 0)
|
||||
(- 10 (rand-int 20)))
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0))
|
||||
entities)
|
||||
|
||||
|
||||
layers (get-layers entities)
|
||||
|
||||
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
|
||||
|
||||
Reference in New Issue
Block a user