nx_wasm_thirdperson.nx
buildroot/runtime/nx_wasm_thirdperson.nx
about
nx_wasm_thirdperson.nx -- BROWSER-PLAYABLE sovereign Third-Person explorer: BASE-RELATIVE integer core, runs
native (-> PNG) AND in the browser (base = 0). NO float, NO JS logic, NO canvas drawing. A FOLLOW CAMERA
keeps the avatar centered while a world LARGER than the screen scrolls under it; move 4-directionally to
collect every item then reach the goal (win). init()/tick(input)/render()/score()/ww()/hh()/fb_off() = the
wasm interface; input bits 1=up 2=down 4=left 8=right. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_nishi_font_core.nx
imported by: nx_wasm_thirdperson_gate.nx
structs
| none |
consts
| 7 | const W: i64 = 128 // viewport |
| 8 | const H: i64 = 112 |
| 9 | const WW: i64 = 288 // world |
| 10 | const WH: i64 = 224 |
| 11 | const NI: i64 = 5 |
| 12 | const MOVE: i64 = 2 |
| 13 | const O_FB: i64 = 0 // framebuffer W*H i64 |
| 14 | const O_IX: i64 = 114688 // item world-x[16] (W*H*8) |
| 15 | const O_IY: i64 = 114816 |
| 16 | const O_IG: i64 = 114944 // item collected[16] |
| 17 | const O_ST: i64 = 115072 // scalars[16]: 0=wx 1=wy 2=collected 3=won 4=gx 5=gy |
| 18 | const O_MSK: i64 = 115200 |
| 19 | const O_STR: i64 = 123392 |
functions
| 21 | func rgb(r: i64, g: i64, b: i64) -> i64 { return (r & 255) | ((g & 255) << 8) | ((b & 255) << 16) } called by 1: render_impl |
| 22 | func clampi(v: i64, lo: i64, hi: i64) -> i64 { if v < lo { return lo } if v > hi { return hi } return v } |
| 23 | func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: tick_impl |
| 25 | func fillr(base: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64 called by 1: render_impl |
| 37 | func disc(base: i64, cx: i64, cy: i64, rad: i64, c: i64) -> i64 called by 1: render_impl |
| 52 | func init_impl(base: i64) -> i64 |
| 63 | func tick_impl(base: i64, input: i64) -> i64 |
| 81 | func render_impl(base: i64) -> i64 |
| 113 | func init() -> i64 { return init_impl(0) } calls 1: init_impl |
| 114 | func tick(input: i64) -> i64 { return tick_impl(0, input) } calls 1: tick_impl |
| 115 | func render() -> i64 { return render_impl(0) } calls 1: render_impl |
| 116 | func score() -> i64 { let st: *i64 = (0 + O_ST) as *i64; return st[2] } |
| 117 | func fb_off() -> i64 { return O_FB } |
| 118 | func ww() -> i64 { return W } |
| 119 | func hh() -> i64 { return H } |