add objects as seprate key in level
This commit is contained in:
parent
a457893d14
commit
e00250fd84
3 changed files with 14 additions and 6 deletions
|
|
@ -73,6 +73,14 @@
|
|||
(fn [x tile] (conj {:x (* x 25) :y (* y 25)} tile))
|
||||
row))) tiles))
|
||||
|
||||
:objects
|
||||
(let [objects (:content (first (filter #(= (get-in % [:attrs :name]) "objects") (:content map-tmx))))]
|
||||
(vec (map (fn [obj]
|
||||
(let [attrs (dissoc (:attrs obj) :id)
|
||||
tags (flatten (map :content (:content obj)))
|
||||
properties (map #(hash-map (keyword (get-in % [:attrs :name])) (get-in % [:attrs :value])) tags)]
|
||||
|
||||
(into attrs properties))) objects)))
|
||||
:spawns
|
||||
(let [spawns (first (filter #(= (get-in % [:attrs :name]) "spawns") (:content map-tmx)))
|
||||
player-1 (first (filter #(= (get-in % [:attrs :name]) "player_1") (:content spawns)))
|
||||
|
|
@ -86,7 +94,7 @@
|
|||
:tutorial (parse-map tutorial-map-tmx)}
|
||||
:colliders colliders})
|
||||
|
||||
;; (pprint (get-in levels [:levels :level-001 :spawns]))
|
||||
(pprint (get-in levels [:levels :tutorial :objects]))
|
||||
;; (pprint/pprint {:row (first (:tiles level-001))})
|
||||
;; (pprint/pprint (pr-str level-001))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue