load collider boxes
Press any key to quit" 10 10))
This commit is contained in:
parent
63b9221590
commit
506cd5a28e
5 changed files with 858 additions and 100 deletions
|
|
@ -13,17 +13,21 @@
|
|||
(:content walls-tsx)
|
||||
(remove string?)
|
||||
(filter #(= (:tag %) :tile))
|
||||
(map (fn [tile] (hash-map
|
||||
:id (get-in tile [:attrs :id])
|
||||
:boxes
|
||||
(->> (:content tile)
|
||||
(remove string?)
|
||||
(map :content)
|
||||
(flatten)
|
||||
(remove string?)
|
||||
(map :attrs)
|
||||
(map #(select-keys % [:x :y :height :width]))
|
||||
(map #(update-vals % (fn [v] (Math/round (Double/parseDouble v)))))))))))
|
||||
(reduce (fn [acc tile]
|
||||
(conj acc
|
||||
{(Integer/parseInt (get-in tile [:attrs :id]))
|
||||
(vec
|
||||
(->> (:content tile)
|
||||
(remove string?)
|
||||
(map :content)
|
||||
(flatten)
|
||||
(remove string?)
|
||||
(map :attrs)
|
||||
(map #(select-keys % [:x :y :height :width]))
|
||||
(map #(update-vals % (fn [v] (Math/round (Double/parseDouble v)))))))}))
|
||||
|
||||
{})))
|
||||
(pprint/pprint wall-colliders)
|
||||
|
||||
(def level-001-tmx (xml/parse (io/reader "./tiled/level_001.tmx")))
|
||||
(def level-001
|
||||
|
|
@ -48,6 +52,7 @@
|
|||
|
||||
(hash-map
|
||||
:tiles tiles
|
||||
:wall-colliders wall-colliders
|
||||
:spawns (vec (reduce (fn [acc tag]
|
||||
(if (= (:tag tag) :object)
|
||||
(conj acc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue