# Block Step

An original, AI-authored browser coding demonstration. It combines platform jumping with one fixed block-placement slot. It does not load, modify, or merge external game files.

## Run

1. Extract the source ZIP.
2. Open `block-step/index.html` in a browser by double-clicking the file.
3. Select **Play Block Step**.

The scripts are classic local scripts. No package installation, imports, API keys, network calls, or server are required for gameplay. If your browser restricts local files, serve this folder instead:

```sh
cd /path/to/block-step
python3 -m http.server 8000 --bind 127.0.0.1
```

Open `http://127.0.0.1:8000/` in your browser. Stop the server with `Control+C` when finished. The published page offers a ZIP download and a return link to the guide. Local copies hide those site controls because the extracted folder contains only the example.

## Play

| Action | Keyboard | Visible control |
| --- | --- | --- |
| Move left | A or Left arrow | Hold Left |
| Move right | D or Right arrow | Hold Right |
| Jump | Space, W, or Up arrow | Jump |
| Place the one block | E | Place block |
| Restart | R | Restart |
| Pause / resume | P | Pause / Resume |
| Exit to the launch screen | Escape | Exit |

Use Tab to select controls. Use Enter or Space to activate a selected button. A keyboard activation of Left or Right moves one short step. Focus the board to use Space for jumping.

Place the block before walking into the marked slot. Jump right onto the block and release movement while landing. From the block, jump right onto the raised platform. Walk toward the lime goal. There is no time limit.

You can place only one block, in the marked slot. Placement is refused while the player overlaps that slot. Restart clears the block and returns the player to the start. Exit and reopen also reset the game. Pause, a hidden tab, or a window losing focus clears held inputs. Select Resume and press movement keys again to continue. Progress is not saved across reloads or exits.

## Two versions

- `baseline.html` is v0.1: movement, jumping, restart, pause and exit. Its goal is intentionally unreachable.
- `index.html` is v0.2: the same baseline plus one block. Two jumps can reach the goal.

The baseline remains runnable. To return to it, open `baseline.html`. To modify the example, edit `physics.js` for game rules, `game.js` for controls and drawing, or `styles.css` for the layout. Keep a copy of the extracted folder before editing.

`physics.js` exposes `globalThis.BlockStepPhysics` in browsers and Node. Its pure state transitions are `createState(version)`, `step(state, input, seconds)`, `placeBlock(state)`, `pause(state)`, `resume(state)`, `close(state)` and `open(state)`. `version` is `baseline` or `complete`. The step input has `left`, `right` and a one-frame `jumpPressed` pulse. Transitions return a new state. State fields include `status`, `version`, `player`, `block` and `jumps`.

## Physical baseline

Movement is 240 pixels per second. The jump impulse is 480 pixels per second. Gravity is 1,500 pixels per second squared. The continuous-motion jump rise is `480² / (2 × 1500) = 76.8` pixels. The numerical step produces a slightly lower rise.

The platform is 116 pixels above the floor. The block is 52 pixels high. The remaining platform rise from the block is 64 pixels. This makes the block necessary for the legal floor-to-goal path. Elapsed time clamps at 0.1 seconds, with collision substeps at most 1/120 second. A slow frame therefore slows game time instead of jumping across the level.

## Scope and verification

This is a one-level prototype with a fixed world, rectangular collisions and in-memory progress. It has no account, storage, telemetry, audio, remote assets, payments, generated maps, or game-file import. It has visible touch controls, keyboard controls, status text and no decorative motion. The platforming task remains visual; this is not a fully nonvisual game.

The repository test file is `test/block-step.test.mjs`. Run it from the repository root with:

```sh
node --test test/block-step.test.mjs
```

The checks cover independent motion calculations, the legal two-jump path, unreachable goals without a block, collisions, bounded time steps, resets, and input cancellation using a simulated DOM. These checks are not browser playthroughs or real-device tests. Any separate browser checks and AI testing sessions must be reported with their actual evidence.

## License and provenance

Copyright 2026 Merging Games contributors. Original code and graphics were written with AI assistance for this tutorial. No commercial game code or art is included. The files in this folder use the MIT license in `LICENSE`.

If Play stays unavailable, a required script has not finished loading. Reload the page. For an extracted copy, keep physics.js and game.js beside the HTML file. The source notes remain readable when JavaScript is unavailable.
