diff options
Diffstat (limited to 'examples/noc/test/flappy_bird.script')
| -rw-r--r-- | examples/noc/test/flappy_bird.script | 94 |
1 files changed, 94 insertions, 0 deletions
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 |
