portals 1

This commit is contained in:
2026-06-13 17:58:04 -05:00
parent 49d32eedf5
commit 6818f0545a
9 changed files with 151 additions and 7 deletions
+11 -2
View File
@@ -22,13 +22,22 @@ fn tick(dt) {
"""
mover = """
fn init() {
if Registry.get("dancer_x") != () {
teleport(Registry.get("dancer_x"), Registry.get("dancer_y"));
} else {
Registry.set("dancer_x", Me.x);
Registry.set("dancer_y", Me.y);
log(`Set reg to ${Me.x} ${Me.y}`);
}
}
// move() costs 250 ms, so the object steps ~4 cells/sec no matter how often
// tick() runs. Queue.length() avoids piling up moves; blocked() avoids walking
// into a wall (or another object's already-queued move this tick).
fn tick(dt) {
if Queue.length() == 0 { init(); }
if Queue.length() == 0 { dance(); }
}
fn init() {
fn dance() {
move(East);
move(South);
move(North);