From 6933f99ddb2d7103515d26838496309a807bba26 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 16 Nov 2026 21:28:20 -0300 Subject: Move standalone sketches into sketchbook examples --- examples/noc/test/flappy_bird.script | 94 ++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 examples/noc/test/flappy_bird.script (limited to 'examples/noc/test/flappy_bird.script') diff --git a/examples/noc/test/flappy_bird.script b/examples/noc/test/flappy_bird.script new file mode 100644 index 0000000..8289848 --- /dev/null +++ b/examples/noc/test/flappy_bird.script @@ -0,0 +1,94 @@ +# The bird falls; space (or a click) flaps. Pipes come every 100 steps +# from the right; passing one scores. The script flaps whenever the bird +# is down to about 295, which takes it through the first two gaps (the +# first is 237..337), then lets it drop: past one more pipe, onto the next. +# The round ends ("OOPS!"), nothing moves, and a click starts the next +# round, keeping the best score. +expect pipes.buffer[0].top 236.904 ~0.001 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +await bird.y 295 ~10 +key space +frames 8 +expect score 2 +expect over false +screenshot .zig-cache/e2e/flappy_bird.png +await over true +expect score 3 +expect best 3 +frames 30 +expect over true +screenshot .zig-cache/e2e/flappy_bird-over.png +click 320 180 +expect over false +expect score 0 +expect best 3 +expect pipes.len 1 +expect bird.y 120 -- cgit v1.3