Files
gitea-docker/desktop/src-common/advent/screens/rooms/held.clj
2015-05-11 20:23:47 -07:00

45 lines
2.4 KiB
Clojure

(ns advent.screens.rooms.held
(: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]
[advent.tween :as tween]
[clojure.zip :as zip]
[clojure.set :as set]
[clojure.string :as str]
[play-clj.core :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.math :refer :all]
[play-clj.g2d :refer :all]))
(defn bloodclot-talk-script [entities]
(actions/talk entities :ego "Let me down Bloodclot!" :anim :suspended-talk)
(actions/do-dialogue entities :bloodclot-head "Not a chance."
:bloodclot-head "It's dinnertime, runt."))
(defn make [screen]
(let [bloodclot-talk (utils/make-anim "held/bloodclot-head.png" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
bloodclot-stand (utils/make-anim "held/bloodclot-head.png" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))]
(rooms/make :music :fight
:interactions {}
:layers [(assoc (texture "held/background.png") :x 0 :y 0 :baseline 0)]
:entities {:bloodclot-head (assoc (animation->texture screen bloodclot-stand)
:x 211 :y 114 :baseline 240
:origin-x 57 :origin-y 0
:script (actions/get-script entities
(bloodclot-talk-script entities))
:stand bloodclot-stand
:talk bloodclot-talk
:anim bloodclot-stand
:anim-start 0)}
:collision "held/collision.png"
:scale-fn (constantly 1.5)
:start-pos [113 120]
:apply-state (fn [screen e]
(-> e
(assoc-in [:cam :paused? ] true)
(update-in [:tweens] dissoc :cam-x :cam-y)
(update-in [:room :entities :ego] #(actions/start-animation screen % :suspended)))))))