public void Rotate(bool Clockwise) { if (Clockwise) { switch (formation) { case iblockState.one: formation = iblockState.two; UpdateFormation(); break; case iblockState.two: formation = iblockState.three; UpdateFormation(); break; case iblockState.three: formation = iblockState.four; UpdateFormation(); break; case iblockState.four: formation = iblockState.one; UpdateFormation(); break; } } else if (!Clockwise) { switch (formation) { case iblockState.one: formation = iblockState.four; UpdateFormation(); break; case iblockState.two: formation = iblockState.one; UpdateFormation(); break; case iblockState.three: formation = iblockState.two; UpdateFormation(); break; case iblockState.four: formation = iblockState.three; UpdateFormation(); break; } } }
public I(Texture2D color, Vector2 startPos) { this.color = color; //this.startPos = startPos; iMatrix = new TetrisObject[4, 4]; //Contents of the I, looping through the dubbelarray setting positions and textures for (int i = 0; i < iMatrix.GetLength(0); i++) { for (int j = 0; j < iMatrix.GetLength(1); j++) { iMatrix[i, j] = new TetrisObject(Vector2.Zero, color); iMatrix[i, j].PosX = startPos.X + i * color.Width; iMatrix[i, j].PosY = startPos.Y + j * color.Height; } } formation = iblockState.one;//Default formation of the I figure UpdateFormation(); }