first step in large refactoring to extract rooms.
This commit is contained in:
57
desktop/src-common/advent/screens/rooms/outside_castle.clj
Normal file
57
desktop/src-common/advent/screens/rooms/outside_castle.clj
Normal file
@@ -0,0 +1,57 @@
|
||||
(ns advent.screens.rooms.outside-castle
|
||||
(:require [advent.screens.rooms :as rooms]
|
||||
[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 make [screen]
|
||||
(let [peddler-sheet (texture! (texture "outside-castle/peddler-talk.png" ) :split 18 36)
|
||||
peddler-talk (animation 0.18 (for [i (flatten [2 3 2 3 2 3 6 1 0 1 0 1 0 1 0 1 2 3 2 3 2 3 6 4 5 4 5 4 5 4 5])]
|
||||
(aget peddler-sheet 0 i)))
|
||||
peddler-stand (animation 0.2 (for [i (flatten [(repeat 5 0) 6])]
|
||||
(aget peddler-sheet 0 i)))]
|
||||
(rooms/make :interactions
|
||||
{:right-dir {:box [300 40 320 140]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(actions/walk-to entities :ego [310 80])
|
||||
(actions/transition-background entities :outside-house [0 80]))
|
||||
:cursor :right}
|
||||
:garden {:box [103 170 178 200]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(if ((get-in @entities [:state :inventory]) :carrot)
|
||||
(actions/talk entities :ego "If I steal any more, I might get caught.")
|
||||
(do
|
||||
(actions/walk-to entities :ego [128 180])
|
||||
(actions/talk entities :ego "Hey! Carrots. No one will notice one missing.")
|
||||
(actions/give entities :carrot))))}
|
||||
:peddler {:box [110 90 128 146]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
(actions/walk-to entities :ego [191 90])
|
||||
(actions/talk entities :ego "Hello there, peddler.")
|
||||
(actions/talk entities :peddler "Good day sir! Care to see any of my wares?" :stop? false)
|
||||
(actions/talk entities :peddler "I have only the choicest of wares.")
|
||||
(actions/talk entities :ego "What 'wares' are you selling?")
|
||||
(actions/talk entities :peddler "I have the choicest of all types of wares..." :stop? false)
|
||||
(actions/talk entities :peddler "...I'm well stocked on used earplugs..." :stop? false)
|
||||
(actions/talk entities :peddler "...glass eyes, motivational tapes... " :stop? false)
|
||||
(actions/talk entities :peddler "...and useful books like this:" :stop? false)
|
||||
(actions/talk entities :peddler "'Checkers Mastery in Less Than 10 Seconds'")
|
||||
(actions/talk entities :ego "I sure am interested on that book on checkers.")
|
||||
(actions/talk entities :peddler "An excellent selection! It is the choicest of checkers book you'll ever find." :stop? false)
|
||||
(actions/talk entities :peddler "This book will only set you back 75 sheckels.")
|
||||
(actions/talk entities :ego "But I haven't got any money!")
|
||||
(actions/talk entities :peddler "Then you won't have the choicest of checkers books."))}}
|
||||
:layers [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
|
||||
:entities {:peddler (actions/start-animation screen
|
||||
(assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil
|
||||
:talk peddler-talk :stand peddler-stand)
|
||||
:stand)}
|
||||
:collision "outside-castle/collision.png"
|
||||
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00))))
|
||||
Reference in New Issue
Block a user