actually get ladder, also fixes performance problem.

This commit is contained in:
2014-11-19 16:02:59 -08:00
parent 50a9423205
commit db97c2d76f
5 changed files with 22 additions and 16 deletions

View File

@@ -85,13 +85,13 @@
{})))) {}))))
:on-mouse-moved (fn [screen [entities]] :on-mouse-moved (fn [screen [entities]]
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)}) (when (seq entities)
font (bitmap-font "ego/font.fnt" )] (let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})
(when (seq entities) font (bitmap-font "ego/font.fnt" )]
(doseq [index (range (dec (count entities)))] (doseq [index (range (dec (count entities)))]
(if (< (* index 30) y (* (inc index) 30)) (if (< (* index 30) y (* (inc index) 30))
(label! (entities index) :set-style (style :label font (color :yellow))) (label! (entities index) :set-style (style :label font (color :yellow)))
(label! (entities index) :set-style (style :label font (color :white)))))))) (label! (entities index) :set-style (style :label font (color :white))))))))
:on-resize (fn [screen entities] :on-resize (fn [screen entities]
(size! screen 1280 960))) (size! screen 1280 960)))

View File

@@ -49,7 +49,7 @@
(def stick {:name "Stick" :value :stick :cursor :stick :scripts {:wool make-cat-toy}}) (def stick {:name "Stick" :value :stick :cursor :stick :scripts {:wool make-cat-toy}})
(def balloon {:name "Choicest of balloons" :value :balloon :cursor :balloon}) (def balloon {:name "Choicest of balloons" :value :balloon :cursor :balloon})
(def frog-legs {:name "Frog legs" :value :frog-legs :cursor :frog-legs}) (def frog-legs {:name "Frog legs" :value :frog-legs :cursor :frog-legs})
(def stool {:name "Stool" :value :stool :cursor :stool}) (def ladder {:name "ladder" :value :ladder :cursor :ladder})
(def teddy {:name "Teddy Bear" :value :teddy :cursor :teddy}) (def teddy {:name "Teddy Bear" :value :teddy :cursor :teddy})
(def portrait {:name "Portrait" :value :portrait :cursor :portrait}) (def portrait {:name "Portrait" :value :portrait :cursor :portrait})
(def recipe {:name "Strength potion recipe" :value :recipe :cursor :recipe}) (def recipe {:name "Strength potion recipe" :value :recipe :cursor :recipe})

View File

@@ -74,12 +74,18 @@
{:run #(actions/respond entities % {:run #(actions/respond entities %
:ladder-guard "No.") :ladder-guard "No.")
:choices ["Pretty pretty please?" :choices ["Pretty pretty please?"
{:run #(do (actions/respond entities % {:run #(actions/respond entities %
:ladder-guard "Well, okay." :ladder-guard "No.")
:ladder-guard "Do not darest telleth a soul, or the Duke will haveth my head!") :choices ["Pretty pretty pretty please?"
(actions/walk-to entities :ego [245 75] :face :right) {:run #(do (actions/respond entities %
(actions/play-animation entities :ego :reach) :ladder-guard "Well, okay."
(actions/remove-entity entities :ladder))} :ladder-guard "Do not darest telleth a soul, or the Duke will haveth my head!")
(actions/walk-to entities :ego [245 75] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :ladder)
(actions/give entities items/ladder))}
"Nevermind."
{:run #(actions/respond entities %)}]}
"Nevermind." "Nevermind."
{:run #(actions/respond entities %)}]} {:run #(actions/respond entities %)}]}
"Nevermind." "Nevermind."

View File

@@ -264,7 +264,7 @@
:on-mouse-moved :on-mouse-moved
(fn [screen [entities]] (fn [screen [entities]]
(when (get-in entities [:state :active?]) #_(when (get-in entities [:state :active?])
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})] (let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(if-let [mouse-override (find-override screen entities [x y])] (if-let [mouse-override (find-override screen entities [x y])]
(assoc-in entities [:cursor :override] (:cursor mouse-override)) (assoc-in entities [:cursor :override] (:cursor mouse-override))

View File

@@ -11,7 +11,7 @@
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})] (let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(println (:input-x screen) (:input-y screen) "->" x y))) (println (:input-x screen) (:input-y screen) "->" x y)))
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :stool :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal]) (def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal])
(defn cursor [filename which] (defn cursor [filename which]
(let [scale 2 (let [scale 2