From 0f990eb95a9ef3a1be8847a863f7216a8625692a Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Thu, 18 Dec 2025 20:28:53 -0500 Subject: add bouncing when hitting arena edge --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 2aedfff..240acf1 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -135,6 +135,14 @@ impl ExportedVM { vm.ip.offset = 0; } + pub fn setheading(&mut self, v: forth::vm::DataStackType) { + let Some(vm) = &mut self.vm else { + return; + }; + use forth::vm::UNITS_PER_ROTATION; + vm.heading = (UNITS_PER_ROTATION + (v % UNITS_PER_ROTATION)) % UNITS_PER_ROTATION; + } + pub fn trans(&mut self) -> Result { let vm = (&mut self.vm).as_mut().ok_or(Error::NoVM)?; let res = js_sys::Map::new(); -- cgit v1.3