adding more detail.

This commit is contained in:
2014-12-10 18:05:35 -08:00
parent 04bac2afb9
commit e7c2acead2
5 changed files with 94 additions and 41 deletions

View File

@@ -6,6 +6,7 @@
[clojure.zip :as zip]
[play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.math :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
@@ -118,7 +119,8 @@
sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 9 10 (repeat 25 11) (repeat 15 12)])]
(aget sheep-stand-sheet 0 i)))
sheep-walk (animation 0.05 (for [i (range 6)]
(aget sheep-walk-sheet 0 i)))]
(aget sheep-walk-sheet 0 i)))
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])]
(rooms/make :music :town-2
:interactions
{:door {:box [258 100 281 160]
@@ -194,7 +196,20 @@
:stand (utils/flip sheep-stand)}
:right {:walk sheep-walk
:stand sheep-stand})
sheep-stand)}
sheep-stand)
:butterfly (assoc (animation->texture screen butterfly-stand)
:x 161
:y 218
:baseline 240
:anim butterfly-stand
:anim-start 0
: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)))))}
:collision "outsidehouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:apply-state (fn [entities]