diff options
| author | Brian Cully <bjc@spork.org> | 2025-12-18 20:28:53 -0500 |
|---|---|---|
| committer | Brian Cully <bjc@spork.org> | 2025-12-18 20:36:39 -0500 |
| commit | 0f990eb95a9ef3a1be8847a863f7216a8625692a (patch) | |
| tree | 9742a3730168e0ed9b1b6d259a79a430eda71f31 /src/lib.rs | |
| parent | 8e65c1c439b2fc0d0ae5d8482e9350e283cde882 (diff) | |
| download | automathon-0f990eb95a9ef3a1be8847a863f7216a8625692a.tar.gz automathon-0f990eb95a9ef3a1be8847a863f7216a8625692a.zip | |
add bouncing when hitting arena edge
Diffstat (limited to 'src/lib.rs')
| -rwxr-xr-x | src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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<js_sys::Object, JsValue> { let vm = (&mut self.vm).as_mut().ok_or(Error::NoVM)?; let res = js_sys::Map::new(); |
