An implementation of the game Tetris, targeting WebAssembly, written in Rust with no external dependencies.
- Install the
wasm32-unknown-unknown
target with rustup:rustup target add wasm32-unknown-unknown
- Download and build the game:
git clone https://github.com/dprien/rstetris.git cd rstetris cargo build --release --target=wasm32-unknown-unknown
- Start a local webserver to serve the games' files:
python -m http.server 8000 --bind 127.0.0.1 --directory web/
- Point your favorite browser to http://127.0.0.1:8000.
- Space - Start a new game (on title or "Game Over" screen)
- Esc - Abort the current game
- A / D - Move left / right
- S / W - "Soft" / "Hard" drop
- ← / → - Rotate counter-clockwise / clockwise
Swipe up
- Start a new game (on title or "Game Over" screen)Swipe left
/right
- Move left / rightSwipe down
- "Soft" dropSwipe up
- "Hard" dropTap
- Rotate clockwise
- No external dependencies, like wasm-bindgen, web-sys or js-sys.
- No additional tooling, like wasm-pack or npm.
- Tablet & smartphone support, using Touch events.
- Multiple game modes, like 40 lines or Endless.
- Sound, using the Web Audio API.
- Multiplayer, either peer-to-peer (via WebRTC's
RTCDataChannel
) or server-client (via WebSockets).
This project is licensed under the GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.html).