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))
|
(fn [x tile] (conj {:x (* x 25) :y (* y 25)} tile))
|
||||||
row))) tiles))
|
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
|
:spawns
|
||||||
(let [spawns (first (filter #(= (get-in % [:attrs :name]) "spawns") (:content map-tmx)))
|
(let [spawns (first (filter #(= (get-in % [:attrs :name]) "spawns") (:content map-tmx)))
|
||||||
player-1 (first (filter #(= (get-in % [:attrs :name]) "player_1") (:content spawns)))
|
player-1 (first (filter #(= (get-in % [:attrs :name]) "player_1") (:content spawns)))
|
||||||
|
|
@ -86,7 +94,7 @@
|
||||||
:tutorial (parse-map tutorial-map-tmx)}
|
:tutorial (parse-map tutorial-map-tmx)}
|
||||||
:colliders colliders})
|
: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 {:row (first (:tiles level-001))})
|
||||||
;; (pprint/pprint (pr-str level-001))
|
;; (pprint/pprint (pr-str level-001))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@
|
||||||
"expandedObjectLayers": [
|
"expandedObjectLayers": [
|
||||||
2
|
2
|
||||||
],
|
],
|
||||||
"scale": 2.2046,
|
"scale": 1.1429,
|
||||||
"selectedLayer": 1,
|
"selectedLayer": 0,
|
||||||
"viewCenter": {
|
"viewCenter": {
|
||||||
"x": 636.1698267259367,
|
"x": 657.5378423309126,
|
||||||
"y": 1051.8914995917626
|
"y": 883.7168606177268
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"walls.tsx": {
|
"walls.tsx": {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue