This commit is contained in:
2014-12-11 16:23:13 -08:00
5 changed files with 43 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -394,6 +394,31 @@
(can-skip? [this screen entities]
false)))
(defn transition-music
([entities new-music]
(transition-music entities (get-in @entities [:room :music]) new-music))
([entities old-music new-music]
(let [current-volume (atom 1.0)]
(run-action entities
(begin [this screen entities]
entities)
(continue [this screen entities]
(let [new-volume (swap! current-volume #(- % 0.01))]
(music! (get-in entities [:musics old-music]) :set-volume new-volume))
entities)
(done? [this screen entities]
(>= 0.1 @current-volume))
(terminate [this screen entities]
(music! (get-in entities [:musics old-music]) :stop)
(music! (get-in entities [:musics new-music]) :set-volume 1.0)
(music! (get-in entities [:musics new-music]) :play)
entities)
(can-skip? [this screen entities]
false)))))
(defn transition-background [entities new-background [x y]]
(let [old-music (get-in @entities [:room :music])
new-music (get-in @entities [:rooms new-background :music])

View File

@@ -9,6 +9,12 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn make-fight-entity []
(assoc (texture "inside-castle/fight-1.png")
:x 0
:y 0
:baseline 1000))
(defn do-warrior-dialogue [entities]
(actions/walk-to entities :ego [150 45] :face :left)
(actions/talk entities :ego "Hey guys!")
@@ -43,11 +49,13 @@
(actions/do-dialogue entities :ego "One sec.")
(actions/play-animation entities :ego :grow)
(actions/do-dialogue entities
:warriors "[Todo animation here]"
:warriors "Congratulations young master. Thou art worthy in might."
:warriors "Take my medal of strength.")
(actions/give entities :medal))
(do
(actions/transition-music entities :town-2 :fight)
(actions/add-entity entities :fight (get-in @entities [:room :fight]))
(actions/do-dialogue entities
:warriors "[Todo animation here]"
:warriors "You lost, young master. Go hitherto, unto thy gym."))))}
@@ -120,7 +128,8 @@
ladder-guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87)
ladder-guard-stand (animation 0.1 [(aget ladder-guard-sheet 0 0)])
ladder-guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]]
(aget ladder-guard-sheet 0 i)))]
(aget ladder-guard-sheet 0 i)))
]
(rooms/make :music :town-1
:interactions
{:right-dir {:box [300 0 320 120]
@@ -132,7 +141,8 @@
:cursor :right}
}
:layers [(assoc (texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)]
:entities {:warriors (actions/start-animation screen (assoc (animation->texture screen warriors-stand) :x 5 :y 9 :baseline 180
:entities {
:warriors (actions/start-animation screen (assoc (animation->texture screen warriors-stand) :x 5 :y 9 :baseline 180
:left {:stand (utils/flip warriors-stand)
:talk (utils/flip warriors-stand)}
@@ -152,6 +162,7 @@
:script (actions/get-script entities
(actions/talk entities :ladder-guard "Do not toucheth, young sire.")))}
:collision "inside-cafeteria/collision.png"
:fight (make-fight-entity)
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)
:apply-state (fn [entities]
(as-> entities entities

View File

@@ -1,4 +1,5 @@
(ns advent.screens.scene
(:refer-clojure :exclude [load])
(:require [play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
@@ -245,7 +246,8 @@
:inside-antique (make-music "inside-antique.ogg")
:town-1 (make-music "town-music-1.ogg")
:town-2 (doto (make-music "town-music-2.ogg") play-sound)
:inside-fangald (make-music "inside-fangald.ogg")}
:inside-fangald (make-music "inside-fangald.ogg")
:fight (make-music "megaboss.mp3")}
:state (get-state)
:actions {:object nil
:channel (chan)

View File

@@ -1,4 +1,5 @@
(ns advent.utils
(:refer-clojure :exclude [load])
(:require [play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]