/tetrs

a crappy, unofficial, implementation of something resembling Tetris.

Primary LanguageRust

tetrs

logo

a crappy, unofficial, implementation of something resembling that one game with randomized falling tetrominos.

  • Playable(random piece; pieces rotate and move; rules applied)
  • Basic UI/Scoring (lines clear; score is calculated; next piece displayed).
  • Game Audio (annoying, but functional).
  • Functional Pause/Resume/Restart
  • Supports web

Setup

Local Setup

  • Assumes Rust is installed. If not, see Rustup.

Running the game in debug mode:

cargo run

Building the game for release:

cargo build --release

WASM Setup

  • Assumes Rust is installed. If not, see Rustup.
  • Ensure that the wasm32-unknown-unknown target is installed: rustup target install wasm32-unknown-unknown

Running locally requires wasm-server-runner.

cargo install wasm-server-runner
cargo run --target=wasm32-unknown-unknown

Building the game for release on the web requires the wasm-bindgen-cli tool.

# Ensure its installed!
cargo install wasm-bindgen-cli

# Build the game for WASM.
cargo build --release --target wasm32-unknown-unknown

# Generate the JS bindings.
wasm-bindgen --out-dir=./out/ --target=web ../../target/wasm32-unknown-unknown/release/tetris.wasm
# NOTE that specifically, this repo is a workspace  so target is relative to the workspace root.

Reference