1
0
Fork 0
mirror of https://github.com/imjasonh/nescript synced 2026-07-08 08:55:38 +00:00
nescript/examples/hello_sprite.ne
Claude fd5a940c89
Add example builds to CI, document sprite name behavior
- CI: new "Build Examples" job compiles all .ne files and validates
  the output ROMs have correct iNES headers
- Examples: add notes explaining that sprite names (Smiley, Ball) are
  parsed but not yet resolved — all draws use the built-in CHR tile 0.
  Custom sprite declarations come in M3.
- Codegen: explicit `let _ = &draw.sprite_name` to document the
  intentional skip, with comment about M2/M3 scope

https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
2026-04-11 22:55:43 +00:00

27 lines
693 B
Text

// Hello Sprite — the simplest NEScript program.
//
// Displays a sprite on screen and moves it with the d-pad.
// Build: cargo run -- build examples/hello_sprite.ne
// Output: examples/hello_sprite.nes (open in any NES emulator)
//
// Note: In M1 the sprite name in `draw` is parsed but not resolved.
// All sprites use tile 0 from the built-in CHR data (a smiley face).
// Sprite declarations with custom tile data come in M3.
game "Hello Sprite" {
mapper: NROM
}
var px: u8 = 128
var py: u8 = 120
on frame {
if button.right { px += 2 }
if button.left { px -= 2 }
if button.down { py += 2 }
if button.up { py -= 2 }
draw Smiley at: (px, py)
}
start Main