> For the complete documentation index, see [llms.txt](https://sbscripts.gitbook.io/sb-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sbscripts.gitbook.io/sb-scripts/sb-minigames/games-rhythm.md).

# Games: Rhythm

### RhythmNumbers

Circles holding a digit pop up in random places. A ring closes in around each one. Press that digit **before the ring closes**. Expired circles and wrong keys cost a life.

**Controls:** digit keys `0` to `9`

```lua
exports['sbminigames']:RhythmNumbers({ count = 10, spawnDelay = 600, lifeTime = 1800, lives = 2 }, cb)
```

Positional: `RhythmNumbers(count, spawnDelay, lifeTime, callback)`

| Option       | Type | Default | Range       | What it does                         |
| ------------ | ---- | ------- | ----------- | ------------------------------------ |
| `count`      | int  | `6`     | 3 to 20     | Circles in the round                 |
| `spawnDelay` | int  | `700`   | 400 to 1800 | Milliseconds between new circles     |
| `lifeTime`   | int  | `2200`  | 800 to 3000 | Milliseconds before a circle expires |
| `lives`      | int  | `3`     | 1 to 5      | Mistakes allowed                     |

### RhythmLetters

The same as RhythmNumbers, but the circles hold letters. `I` and `O` are left out so they can't be mistaken for `1` and `0`.

**Controls:** letter keys `A` to `Z`

```lua
exports['sbminigames']:RhythmLetters({ count = 8, lifeTime = 1800 }, cb)
```

Positional: `RhythmLetters(count, spawnDelay, lifeTime, callback)`

Options are the same as RhythmNumbers.

### ArrowRush

Arrows scroll from the right toward a ring on the left. Press the **matching direction** as each arrow lands on the ring. Presses outside the window are ignored. Wrong directions and missed arrows cost a life.

**Controls:** arrow keys or `W` `A` `S` `D`

```lua
exports['sbminigames']:ArrowRush({ count = 16, speed = 1.5, gap = 500 }, cb)
```

Positional: `ArrowRush(count, speed, callback)`

| Option  | Type  | Default | Range       | What it does                |
| ------- | ----- | ------- | ----------- | --------------------------- |
| `count` | int   | `12`    | 6 to 30     | Arrows in the round         |
| `speed` | float | `1.2`   | 0.5 to 3    | Scroll speed multiplier     |
| `gap`   | int   | `650`   | 350 to 1200 | Milliseconds between arrows |
| `lives` | int   | `3`     | 1 to 6      | Mistakes allowed            |
