Posted on ::

SirtetJS is a Game Boy Tetris clone written in JavaScript with Phaser.

  • Rotate clockwise with C, counterclockwise with X.
  • Choose 1 Player on the menu and press space to start. The 2-player option is not supported yet.

SirtetJS menu

SirtetJS playfield

Rotation

Rotation is an index into a table of precomputed shapes, following the Nintendo Rotation System. Each piece stores its orientations, and rotating only moves the index:

getCWIndex() {
    return (this.index + 1) % this.rotations.length;
}
getCCWIndex() {
    let i = (this.index - 1) % this.rotations.length;
    if (i < 0) i = i + this.rotations.length;
    return i;
}
rotateCW() {
    this.index = this.getCWIndex();
}

It builds with Bun and runs from any static file server. Try the live demo, or see the source.

Table of Contents