Clojure for scripting godot games!
and generally just hacking ontop of arcadiaGodot
probably not too crazy if it's already added to the game itself
might need some kind of env management for using forks/versions across games
probably worth reading all of this
// dodge a noisy nullReferenceException
if (message["symbol"] == null) break;
gdscript has some special treatment? https://godotengine.org/qa/20915/godot-3-load-preload-functions-in-c%23
https://github.com/Saikyun/miracle
fork of monroe, emacs nrepl tool
(let [x "hi there"
n 2]
;; (await (Godot.Object/ToSignal 2 "timeout"))
;; (await (Godot.Object/ToSignal (.CreateTimer (Godot.Engine/GetMainLoop) 2 true) "timeout"))
(a/timeout n (fn []
(a/log "waited for n" n x)))
(a/log "fired right away" x))
;; 1
(swap! bullets
(fn [bs]
(let [;; add new bullet to front
new-bs (concat
;; Storing weak refs b/c these can be freed upon
;; impact with enemies
[(Godot.Object/WeakRef bullet-inst)]
bs)
;; split via max-bullets
[to-keep to-destroy] (split-at max-bullets new-bs)
to-keep (vec to-keep)]
;; destroy excess bullets
(doall
(for [b to-destroy] (bullet/kill b)))
;; return new list of bullets
to-keep)))
;; vs 2
(if (> (- (count @bullets) 1) @current-bullet)
(let [to-remove (get @bullets @current-bullet)]
(if to-remove
(do
(a/log "to-remove" to-remove)
(a/log "a/obj" (a/obj to-remove)))
(a/log "no to-remove"))
(when (and to-remove (a/obj to-remove))
(a/log "destroying bullet!" to-remove)
(a/destroy to-remove)))
(swap! bullets #(conj % bullet-inst)))
(swap! current-bullet
#(if (> % max-bullets) 0 (inc %)))