Class OFigure

java.lang.Object
tetris.model.Figure
tetris.model.figures.OFigure

public class OFigure extends Figure
The class OFigure implements an O-shaped figure of the Tetris game.
Version:
2.1
Author:
Stephan Fischli
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
    The color of the figure.

    Fields inherited from class tetris.model.Figure

    blocks
  • Constructor Summary

    Constructors
    Constructor
    Description
    OFigure(int x, int y)
    Creates an O-shaped figure.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    rotate(int d)
    Rotates the figure.

    Methods inherited from class tetris.model.Figure

    getBlocks, shift

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • OFigure

      public OFigure(int x, int y)
      Creates an O-shaped figure.
      Parameters:
      x - the x coordinate of the initial position
      y - the y coordinate of the initial position
  • Method Details

    • rotate

      public void rotate(int d)
      Rotates the figure.
      Overrides:
      rotate in class Figure
      Parameters:
      d - the direction of rotation (+1 right, -1 left))