more starting of the fight.
This commit is contained in:
BIN
desktop/resources/inside-castle/hands-1.png
Normal file
BIN
desktop/resources/inside-castle/hands-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -394,6 +394,31 @@
|
|||||||
(can-skip? [this screen entities]
|
(can-skip? [this screen entities]
|
||||||
false)))
|
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]]
|
(defn transition-background [entities new-background [x y]]
|
||||||
(let [old-music (get-in @entities [:room :music])
|
(let [old-music (get-in @entities [:room :music])
|
||||||
new-music (get-in @entities [:rooms new-background :music])
|
new-music (get-in @entities [:rooms new-background :music])
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
[play-clj.utils :refer :all]
|
[play-clj.utils :refer :all]
|
||||||
[play-clj.g2d :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]
|
(defn do-warrior-dialogue [entities]
|
||||||
(actions/walk-to entities :ego [150 45] :face :left)
|
(actions/walk-to entities :ego [150 45] :face :left)
|
||||||
(actions/talk entities :ego "Hey guys!")
|
(actions/talk entities :ego "Hey guys!")
|
||||||
@@ -43,11 +49,13 @@
|
|||||||
(actions/do-dialogue entities :ego "One sec.")
|
(actions/do-dialogue entities :ego "One sec.")
|
||||||
(actions/play-animation entities :ego :grow)
|
(actions/play-animation entities :ego :grow)
|
||||||
(actions/do-dialogue entities
|
(actions/do-dialogue entities
|
||||||
:warriors "[Todo animation here]"
|
|
||||||
:warriors "Congratulations young master. Thou art worthy in might."
|
:warriors "Congratulations young master. Thou art worthy in might."
|
||||||
:warriors "Take my medal of strength.")
|
:warriors "Take my medal of strength.")
|
||||||
(actions/give entities :medal))
|
(actions/give entities :medal))
|
||||||
(do
|
(do
|
||||||
|
|
||||||
|
(actions/transition-music entities :town-2 :fight)
|
||||||
|
(actions/add-entity entities :fight (get-in @entities [:room :fight]))
|
||||||
(actions/do-dialogue entities
|
(actions/do-dialogue entities
|
||||||
:warriors "[Todo animation here]"
|
:warriors "[Todo animation here]"
|
||||||
:warriors "You lost, young master. Go hitherto, unto thy gym."))))}
|
: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-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-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]]
|
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
|
(rooms/make :music :town-1
|
||||||
:interactions
|
:interactions
|
||||||
{:right-dir {:box [300 0 320 120]
|
{:right-dir {:box [300 0 320 120]
|
||||||
@@ -132,7 +141,8 @@
|
|||||||
:cursor :right}
|
:cursor :right}
|
||||||
}
|
}
|
||||||
:layers [(assoc (texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)]
|
: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)
|
:left {:stand (utils/flip warriors-stand)
|
||||||
:talk (utils/flip warriors-stand)}
|
:talk (utils/flip warriors-stand)}
|
||||||
@@ -152,6 +162,7 @@
|
|||||||
:script (actions/get-script entities
|
:script (actions/get-script entities
|
||||||
(actions/talk entities :ladder-guard "Do not toucheth, young sire.")))}
|
(actions/talk entities :ladder-guard "Do not toucheth, young sire.")))}
|
||||||
:collision "inside-cafeteria/collision.png"
|
:collision "inside-cafeteria/collision.png"
|
||||||
|
:fight (make-fight-entity)
|
||||||
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)
|
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)
|
||||||
:apply-state (fn [entities]
|
:apply-state (fn [entities]
|
||||||
(as-> entities entities
|
(as-> entities entities
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
(ns advent.screens.scene
|
(ns advent.screens.scene
|
||||||
|
(:refer-clojure :exclude [load])
|
||||||
(:require [play-clj.core :refer :all]
|
(:require [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]
|
||||||
@@ -245,7 +246,8 @@
|
|||||||
:inside-antique (make-music "inside-antique.ogg")
|
:inside-antique (make-music "inside-antique.ogg")
|
||||||
:town-1 (make-music "town-music-1.ogg")
|
:town-1 (make-music "town-music-1.ogg")
|
||||||
:town-2 (doto (make-music "town-music-2.ogg") play-sound)
|
: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)
|
:state (get-state)
|
||||||
:actions {:object nil
|
:actions {:object nil
|
||||||
:channel (chan)
|
:channel (chan)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
(ns advent.utils
|
(ns advent.utils
|
||||||
|
(:refer-clojure :exclude [load])
|
||||||
(:require [play-clj.core :refer :all]
|
(:require [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]
|
||||||
|
|||||||
Reference in New Issue
Block a user