add x,y tile location to lvevl-01 caculation
This commit is contained in:
parent
402aa9051c
commit
b183853f77
2 changed files with 10 additions and 5 deletions
|
|
@ -38,11 +38,16 @@
|
||||||
(->>
|
(->>
|
||||||
(remove empty?)
|
(remove empty?)
|
||||||
(map #(str/split % #","))
|
(map #(str/split % #","))
|
||||||
(map (fn [row] (map Integer/parseInt row)))))]
|
(map (fn [row] (map Integer/parseInt row)))))
|
||||||
|
|
||||||
|
tiles (map-indexed
|
||||||
|
(fn [y row]
|
||||||
|
(map-indexed
|
||||||
|
(fn [x tile-id] {:x (* x 25) :y (* y 25) :tile-id tile-id})
|
||||||
|
row)) tile-nums)]
|
||||||
|
|
||||||
(hash-map
|
(hash-map
|
||||||
:tiles tile-nums
|
:tiles tiles
|
||||||
|
|
||||||
:spawns (reduce (fn [acc tag]
|
:spawns (reduce (fn [acc tag]
|
||||||
(if (= (:tag tag) :object)
|
(if (= (:tag tag) :object)
|
||||||
(conj acc
|
(conj acc
|
||||||
|
|
@ -52,7 +57,7 @@
|
||||||
:y (Math/round (Double/parseDouble (get-in tag [:attrs :y])))))
|
:y (Math/round (Double/parseDouble (get-in tag [:attrs :y])))))
|
||||||
acc)) '() (:content (first (filter #(= (get-in % [:attrs :name]) "spawns") tags)))))))
|
acc)) '() (:content (first (filter #(= (get-in % [:attrs :name]) "spawns") tags)))))))
|
||||||
|
|
||||||
(pprint/pprint :row (ffirst (:tiles level-001)))
|
(pprint/pprint {:row (first (:tiles level-001))})
|
||||||
;; :wall-colliders wall-colliders})
|
;; :wall-colliders wall-colliders})
|
||||||
|
|
||||||
;; (fs/write-lines "level_001.lua" (pr-str '(local name "travis")))
|
;; (fs/write-lines "level_001.lua" (pr-str '(local name "travis")))
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue