(ns advent.screens.rooms.inside-cafeteria (:require [advent.screens.rooms :as rooms] [advent.screens.items :as items] [advent.actions :as actions] [advent.utils :as utils] [clojure.zip :as zip] [play-clj.core :refer :all] [play-clj.ui :refer :all] [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) (defn do-warrior-dialogue [entities] (actions/talk entities :ego "Hey guys!") (actions/talk entities :warriors "Hark! Good day, young esquire.") (actions/present-choices entities {:choices ["Why dost thou speaketh in this manner?" {:run #(actions/respond entities % :warriors "`Tis but a tradition!" :warriors "All knights speaketh in such a manner." :warriors "As my father instructedeth unto me as a mere lad: " :warriors "'Son, thou must speaketh in this manner.'" :warriors "And I asketh unto him:" :warriors "'But father, why musteth I speaketh in this manner?'" :warriors "'Yea, my son, for thou art a knight. And thou musteth speaketh in this manner.'" :warriors "And I toldeth unto him:" :warriors "'Thou art my father, and I am thy son. Therefore I will speaketh in this manner.'" :ego "... I think I've got the idea.") :choices actions/previous-choices} "Can I be a knight like you guys?" {:run #(actions/respond entities % :warriors "We thinketh not, young esquire." :warriors "You lacketh the strength and vigor required for such a task.") :choices ["But I'm on a quest to become a knight!" {:run #(actions/respond entities % :warriors "Young esquire, thou art valiant in heart. " :warriors "Departeth henceforth and go hitherto, unto the gym.")} "I challenge you to a arm wrestling match to prove my strength." {:run #(actions/respond entities % :warriors "[TODO] You lose.")} "Something else." {:choices actions/something-else}] } "Goodbye." {:run #(actions/respond entities % :warriors "Fare thee well, and godspeed.")}]})) (defn make [screen] (let [warriors-stand-sheet (texture! (texture "inside-cafeteria/warriors-stand.png") :split 66 126) warriors-stand (animation 0.2 (for [i [0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 2 2 2 2 3 3 3 0 0 0 2 2 2 ]] (aget warriors-stand-sheet 0 i)))] (rooms/make :music :town-1 :interactions {:right-dir {:box [300 0 320 120] :script (actions/get-script entities (actions/walk-to entities :ego [319 50]) (actions/transition-background entities :inside-castle [65 150]) (actions/walk-to entities :ego [126 80])) :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 :left {:stand (utils/flip warriors-stand) :talk (utils/flip warriors-stand)} :right {:stand warriors-stand :talk warriors-stand} :facing :right :script (actions/get-script entities (do-warrior-dialogue entities) )) :stand) } :collision "inside-cafeteria/collision.png" :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50))))