glyph serialization
This commit is contained in:
@@ -41,7 +41,7 @@ fn tick(me, dt) {
|
||||
// Animate the glyph one frame per rotation (changing only the character): the
|
||||
// line spins '/'-'\'-, slash-swapped for counter-clockwise. Frame state lives in
|
||||
// the board Registry, keyed per spinner, since script scope resets each tick.
|
||||
let frames = if cw { [47, 0xc4, 92, 0xb3] } else { [92, 0xc4, 47, 0xb3] };
|
||||
let frames = if cw { ["/", "\u2500", "\\", "\u2502"] } else { ["\\", "\u2500", "/", "\u2502"] };
|
||||
let fkey = `spin_${me.id}`;
|
||||
let f = Board.registry.get_or(fkey, 0);
|
||||
set_tile(frames[f % 4]);
|
||||
|
||||
@@ -28,12 +28,12 @@ fn opposite_tag(me) {
|
||||
else { "BUILTIN_transporter_east" }
|
||||
}
|
||||
|
||||
// The 4-frame animation loop for this direction (CP437 tile codes).
|
||||
// The 4-frame animation loop for this direction.
|
||||
fn frames(me) {
|
||||
if me.has_tag("BUILTIN_transporter_north") { [94, 45, 94, 126] } // ^ - ^ ~
|
||||
else if me.has_tag("BUILTIN_transporter_south") { [118, 95, 118, 45] } // v _ v -
|
||||
else if me.has_tag("BUILTIN_transporter_east") { [41, 124, 41, 62] } // ) | ) >
|
||||
else { [40, 124, 40, 60] } // ( | ( <
|
||||
if me.has_tag("BUILTIN_transporter_north") { ["^", "-", "^", "~"] }
|
||||
else if me.has_tag("BUILTIN_transporter_south") { ["v", "_", "v", "-"] }
|
||||
else if me.has_tag("BUILTIN_transporter_east") { [")", "|", ")", ">"] }
|
||||
else { ["(", "|", "(", "<"] }
|
||||
}
|
||||
|
||||
fn tick(me, dt) {
|
||||
|
||||
Reference in New Issue
Block a user