dprien / rstetris

WebAssembly-Tetris, written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rstetris

An implementation of the game Tetris, targeting WebAssembly, written in Rust with no external dependencies.

How to play

  1. Install the wasm32-unknown-unknown target with rustup:
    rustup target add wasm32-unknown-unknown
    
  2. Download and build the game:
    git clone https://github.com/dprien/rstetris.git
    cd rstetris
    cargo build --release --target=wasm32-unknown-unknown
    
  3. Start a local webserver to serve the games' files:
    python -m http.server 8000 --bind 127.0.0.1 --directory web/
    
  4. Point your favorite browser to http://127.0.0.1:8000.

Controls

Keyboard

  • 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

Touch screen

  • Swipe up - Start a new game (on title or "Game Over" screen)
  • Swipe left / right - Move left / right
  • Swipe down - "Soft" drop
  • Swipe up - "Hard" drop
  • Tap - Rotate clockwise

Project goals & planned features

License

This project is licensed under the GNU General Public License v3.0 (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.html).

About

WebAssembly-Tetris, written in Rust

License:GNU General Public License v3.0


Languages

Language:Rust 87.4%Language:JavaScript 8.6%Language:CSS 2.6%Language:HTML 1.4%