mirror of
https://github.com/imjasonh/nescript
synced 2026-07-08 08:55:38 +00:00
Add example games and quick-start guide
Two example .ne programs with compiled .nes ROMs: - hello_sprite: d-pad controlled sprite movement - bouncing_ball: auto-bouncing sprite with edge detection Includes README with build instructions and emulator setup. https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
parent
39ca246151
commit
a20ddcbbab
3 changed files with 125 additions and 0 deletions
23
examples/hello_sprite.ne
Normal file
23
examples/hello_sprite.ne
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Hello Sprite — the simplest NEScript program.
|
||||
//
|
||||
// Displays a smiley-face 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)
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue