add x,y tile location to lvevl-01 caculation

This commit is contained in:
Travis Shears 2026-04-10 15:00:03 +02:00
parent 402aa9051c
commit b183853f77
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
2 changed files with 10 additions and 5 deletions

View file

@ -38,11 +38,16 @@
(->>
(remove empty?)
(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
:tiles tile-nums
:tiles tiles
:spawns (reduce (fn [acc tag]
(if (= (:tag tag) :object)
(conj acc
@ -52,7 +57,7 @@
:y (Math/round (Double/parseDouble (get-in tag [:attrs :y])))))
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})
;; (fs/write-lines "level_001.lua" (pr-str '(local name "travis")))