Need help with Tetris shape rotation.

Hello. I am new to this forum and this is my first time asking for help here. I normally can figure out solutions on my own. I am working on a Tetris console game for college and cannot figure out how to get the the shapes to cycle through the rotations on each key press. For example, if the player hits the 'w' key it should go to the first rotation for the specified shape, if the 'w' key is pressed again with the same shape the shape rotates to the right, and so on until all rotations have been cycled through and then it goes back to the first rotation. Here is the code that is in question. As it is coded now when the L-shape drops and the 'w' is pressed nothing happens. Please keep in mind that I am not asking for the answer just some guidance and hints as to the solution.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  void shapeMovement(int newShapeTopX, int newShapeTopY, int shapeType, int &shapeRotate)
{
	//L-Shape rotation.
	//First L-Shape
		if(_kbhit())
		{
			userInput = _getch();
			switch(userInput)
			{
			case 'w':
				if(shapeType == 0)
				{
					shape.shapeArray[0][0] = ' '; shape.shapeArray[1][0] = ' '; shape.shapeArray[2][0] = ' '; shape.shapeArray[3][0] = ' ';
					shape.shapeArray[0][1] = ' '; shape.shapeArray[1][1] = 'L'; shape.shapeArray[2][1] = ' '; shape.shapeArray[3][1] = ' ';
					shape.shapeArray[0][2] = ' '; shape.shapeArray[1][2] = 'L'; shape.shapeArray[2][2] = ' '; shape.shapeArray[3][2] = ' ';
					shape.shapeArray[0][3] = ' '; shape.shapeArray[1][3] = 'L'; shape.shapeArray[2][3] = 'L'; shape.shapeArray[3][3] = ' ';
					shape.shapeArray[0][4] = ' '; shape.shapeArray[1][4] = ' '; shape.shapeArray[2][4] = ' '; shape.shapeArray[3][4] = ' ';
				
					//Second L-Shape Rotation
					if(_kbhit())
					{
						userInput = _getch();
						switch (userInput)
						{
						case 'w':
								shape.shapeArray[0][0] = ' '; shape.shapeArray[1][0] = ' '; shape.shapeArray[2][0] = ' '; shape.shapeArray[3][0] = ' ';
								shape.shapeArray[0][1] = ' '; shape.shapeArray[1][1] = ' '; shape.shapeArray[2][1] = ' '; shape.shapeArray[3][1] = ' ';
								shape.shapeArray[0][2] = 'L'; shape.shapeArray[1][2] = 'L'; shape.shapeArray[2][2] = 'L'; shape.shapeArray[3][2] = ' ';
								shape.shapeArray[0][3] = 'L'; shape.shapeArray[1][3] = ' '; shape.shapeArray[2][3] = ' '; shape.shapeArray[3][3] = ' ';
								shape.shapeArray[0][4] = ' '; shape.shapeArray[1][4] = ' '; shape.shapeArray[2][4] = ' '; shape.shapeArray[3][4] = ' ';
						
							//Third L-Shape Rotation.
							if(_kbhit())
							{
								userInput = _getch();

								switch(userInput)
								{
								case 'w':
									shape.shapeArray[0][0] = ' '; shape.shapeArray[1][0] = ' '; shape.shapeArray[2][0] = ' '; shape.shapeArray[3][0] = ' ';
									shape.shapeArray[0][1] = 'L'; shape.shapeArray[1][1] = 'L'; shape.shapeArray[2][1] = ' '; shape.shapeArray[3][1] = ' ';
									shape.shapeArray[0][2] = ' '; shape.shapeArray[1][2] = 'L'; shape.shapeArray[2][2] = ' '; shape.shapeArray[3][2] = ' ';
									shape.shapeArray[0][3] = ' '; shape.shapeArray[1][3] = 'L'; shape.shapeArray[2][3] = ' '; shape.shapeArray[3][3] = ' ';
									shape.shapeArray[0][4] = ' '; shape.shapeArray[1][4] = ' '; shape.shapeArray[2][4] = ' '; shape.shapeArray[3][4] = ' ';
								
									//Fourth L-Shape Rotation
									if(_kbhit())
									{
										userInput = _getch();
										switch(userInput)
										{
										case 'w':
											shape.shapeArray[0][0] = ' '; shape.shapeArray[1][0] = ' '; shape.shapeArray[2][0] = ' '; shape.shapeArray[3][0] = ' ';
											shape.shapeArray[0][1] = ' '; shape.shapeArray[1][1] = ' '; shape.shapeArray[2][1] = 'L'; shape.shapeArray[3][1] = ' ';
											shape.shapeArray[0][2] = 'L'; shape.shapeArray[1][2] = 'L'; shape.shapeArray[2][2] = 'L'; shape.shapeArray[3][2] = ' ';
											shape.shapeArray[0][3] = ' '; shape.shapeArray[1][3] = ' '; shape.shapeArray[2][3] = ' '; shape.shapeArray[3][3] = ' ';
											shape.shapeArray[0][4] = ' '; shape.shapeArray[1][4] = ' '; shape.shapeArray[2][4] = ' '; shape.shapeArray[3][4] = ' ';
											break;
											case 's':
											newShapeTopLeftX++;
											break;
										case 'a':
											newShapeTopLeftY++;
											break;
										case 'd':
											newShapeTopLeftY--;
											break;
										default:
											newShapeTopLeftX++;
											break;
										}
									}
								}
							}

						}
					}		
				}
			}
	}
}

I have been playing with this code for a couple days now and have tried different variations of it. If I write all of the possible rotations within the first case statement then it will cycle through all of the rotations without stopping but I need it to stop on each rotation until the 'w' key is pressed agaain. Any guidance is appreciated. Thank you in advance.
Topic archived. No new replies allowed.