first step in large refactoring to extract rooms.

This commit is contained in:
2014-10-03 20:00:09 -07:00
parent d672c7ab39
commit 098891dd42
9 changed files with 433 additions and 375 deletions

View File

@@ -0,0 +1,34 @@
(ns advent.screens.rooms.inside-house
(: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 [wizard-sheet (texture! (texture "wizard/talk.png") :split 20 46)
wizard-stand (animation 0.2 (for [i (flatten [(repeat 10 0) 1])]
(aget wizard-sheet 0 i)))
wizard-talk (animation 0.2 (for [i [0 2 0 2 1 2 0 3 0 2 0 1 0 2]]
(aget wizard-sheet 0 i)))]
(rooms/make :interactions {:down-dir {:box [151 0 320 20]
:script (actions/get-script entities
(actions/walk-to entities :ego [237 1])
(actions/transition-background entities :outside-house [262 88]))
:cursor :down}
:wizard {:box [228 80 248 126]}}
:layers [(assoc (texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)
(assoc (texture "inside-house/sillhoute.png") :x 0 :y 0 :baseline 240)]
:entities {:wizard (actions/start-animation screen (assoc (animation->texture screen wizard-stand) :x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:left {:talk (utils/flip wizard-talk)
:stand (utils/flip wizard-stand)}
:right {:talk wizard-talk
:stand wizard-stand}
:facing :left)
:stand)}
:collision "inside-house/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.75))))