portals 1
This commit is contained in:
+11
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user