Position of a Piece or a Block - DerekJi/ngtetris GitHub Wiki

Position of a Piece

The position of a piece is the absolute position of the top-left block in the playfield.

  • pX: X value of the piece position
  • pY: Y value of the piece position

image

Position of a Block

The position of a block is the relative position in the piece.

  • bx: x value of the block position
  • by: y value of the block position

Therefore, the absolute position of a block in the playfield is

  • bX: = pX + bx
  • bY: = pY + by

image