added outside particles. Nice effect.

This commit is contained in:
2015-07-27 19:02:59 -07:00
parent f523ab31b5
commit ae91eceee2
9 changed files with 457 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
(ns advent.screens.rooms.behind-house
(:require [advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.screens.items :as items]
[advent.actions :as actions]
[advent.utils :as utils]
@@ -85,10 +86,12 @@
(actions/play-animation entities :ego :reach)
(actions/update-entity entities :peeling #(assoc % :opacity 0))
(actions/update-state entities (fn [state] (assoc state :opened-crack? true)))))))
:bird (utils/make-bird screen [[50 235] [80 220] [100 239] [180 235] [85 225]])}
:bird (utils/make-bird screen [[50 235] [80 220] [100 239] [180 235] [85 225]])
:outside-particles (common/make-outside-particles)}
:collision "behindhouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (get-in entities [:state :opened-crack?])
(assoc-in entities [:room :entities :peeling :opacity] 0)

View File

@@ -2,6 +2,7 @@
(:require [advent.screens.rooms :as rooms]
[advent.actions :as actions]
[advent.screens.items :as items]
[advent.screens.rooms.common :as common]
[advent.utils :as utils]
[clojure.zip :as zip]
[play-clj.core :refer :all]
@@ -161,6 +162,7 @@
:entities {:frankie (make-frankie screen)
:goon-1 (make-goon-1 screen)
:goon-2 (make-goon-2 screen)
:outside-particles (common/make-outside-particles)
}
:walkie-talkies (rooms/make-entity :walkie-talkies
(assoc (animation->texture screen walkie-visible)
@@ -176,6 +178,7 @@
:collision "castle-gate/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30)
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (= :night (get-in entities [:state :time]))
(make-night entities)

View File

@@ -2,6 +2,7 @@
(:require [advent.screens.rooms :as rooms]
[advent.actions :as actions]
[advent.screens.items :as items]
[advent.screens.rooms.common :as common]
[advent.utils :as utils]
[clojure.zip :as zip]
[play-clj.core :refer :all]
@@ -275,7 +276,9 @@
(assoc (texture "cat-tree/tree-and-rock.png") :x 0 :y 0 :baseline 161)
(assoc (texture "cat-tree/brush-l.png") :x -5 :y -5 :parallax 1.3 :baseline 240)
(assoc (texture "cat-tree/tree-r.png") :x 270 :y 0 :scale-x 1.1 :scale-y 1.1 :parallax 1.5 :baseline 240)]}
:entities {:cat (actions/start-animation screen
:entities {
:outside-particles (common/make-outside-particles)
:cat (actions/start-animation screen
(assoc (animation->texture screen cat-stand)
:x 184 :y 173 :baseline 1000
:walk cat-walk
@@ -351,6 +354,7 @@
:collision "cat-tree/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.20)
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (actions/has-item? entities :kiss)
(update-in entities [:room :entities] #(dissoc % :cat))

View File

@@ -182,3 +182,9 @@
(actions/play-animation entities :ego :standup)
(Thread/sleep 15000)
))
(defn make-outside-particles []
(doto (assoc (particle-effect "outside-particles") :x 160 :y 120
:baseline 238)
(particle-effect! :set-position 160 120)))

View File

@@ -370,6 +370,8 @@
(concat p (reverse p))))
:bird-2 (utils/make-bird screen (as-> [[220 225] [195 235] [210 230] [250 225]] p
(concat p (reverse p))))
:outside-particles (common/make-outside-particles)
:door (assoc (animation->texture screen door)
:x 160 :y 97 :baseline 99
:open door
@@ -486,6 +488,7 @@
:collision "inside-castle/collision.png"
:scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00)
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (actions/has-obtained? entities :trophy)
(update-in entities [:room :entities] #(dissoc % :trophy))

View File

@@ -381,6 +381,8 @@
[220 225] [210 230] [250 235]] p
(concat p (reverse p))))
:outside-particles (common/make-outside-particles)
:flies (assoc (animation->texture screen flies-stand)
:x 201
:y 175
@@ -410,6 +412,7 @@
:scale-fn (utils/scaler-fn-from-image "outside-castle/scale-map.png" 0.20 1.00)
:start-pos [259 80]
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(if (#{:night :sunrise} (get-in entities [:state :time]))
(make-night entities)
entities)))))

View File

@@ -455,6 +455,8 @@
:stand sheep-stand}
:scaled true)
sheep-stand)
:outside-particles (common/make-outside-particles)
:magic (assoc (doto (particle-effect "outsidehouse/magic") )
:x 153
:y 105
@@ -514,6 +516,7 @@
:collision "outsidehouse/collision.png"
:scale-fn scaler
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (get-in entities [:state :coaxed-sheep?])
(let [scale ((get-in entities [:room :scale-fn]) [90 138])]

View File

@@ -1,5 +1,6 @@
(ns advent.screens.rooms.outside-jail
(:require [advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.actions :as actions]
[advent.screens.items :as items]
[advent.utils :as utils]
@@ -198,7 +199,8 @@
:baseline 114)
:axe (assoc (texture "outside-jail/axe.png") :x 213 :y 63 :baseline 176 :night-profile :sprite)
:bent-bar-window (assoc (texture "outside-jail/bent-bar-window.png")
:x 69 :y (- 240 63) :baseline 2)}
:x 69 :y (- 240 63) :baseline 2)
:outside-particles (common/make-outside-particles)}
:fountain-sound {:sound (sound "outside-jail/fountain-2.ogg")
:id nil}
@@ -247,6 +249,7 @@
entities)
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(assoc-in entities [:room :fountain-sound :id] (sound! (get-in entities [:room :fountain-sound :sound]) :loop (fountain-vol entities)))