BUY-ORIGINAL ESSAYS ONLINE

You have already displayed the Tetris Bucket, started dropping the shapes

You have already displayed the Tetris Bucket, started dropping the shapes, stopped them at the bottom of the Bucket, and dropped another shape from the top. During this Module, you move/rotate the shape in response to the player input. Add plenty of narrative comments. Your program must be compilable and executable.

If you need guidance, you will find some detailed instruction (below) to assist you.

WRITE THIS ESSAY FOR ME

Tell us about your assignment and we will find the best writer for your paper.

Get Help Now!
    1. Create a function getUserInput() to get the user inputs.
    2. Create a moveShape(int input, int& newShapeTopLeftX, int& newShapeTopLeftY)function. This will have a switch case block that will include a default case which will increase the Y by 1, (i.e., by default the shape will keep falling). Other values of the switch case would be the arrow keys. Here is an enumeration of the arrow key values that you will use.

enum {UP_ARROW=72,DOWN_ARROW=80, LEFT_ARROW=75, RIGHT_ARROW=77};

Handling “left”, “right”, and “down” arrow keys are easy. However, the “up” arrow key rotates the shape which is little more challenging. Here are two (2) approaches:

    1. Multi-dimensional arrays: You can assign all the rotational shapes into multi-dimensional arrays (as outlined in the previous Module). There is no trick to it but it is little laborious and lengthy.
    2. Swap the values of the shape array: Visualize the 2-D array map like a chess board. If you rotate the shape clock-wise, do you see which cells’ values go to which cells? You will do just that. With each rotate you will do a clock-wise rotation just by swapping the values of the shape array cells. It will be little inaccurate, but is enough for this project. Feel free to add more conditions to make it correct. Here is how the swap would look.

Here is a 4×4 2-D shapeArray map:

0,0 | 1,0 | 2,0 | 3,0

0,1 | 1,1 | 2,1 | 3,1

0,2 | 1,2 | 2,2 | 3,2

0,3 | 1,3 | 2,3 | 3,3

Here is the swap:

char tempCellVal = shapeArray[0][0];

shapeArray[0][0] = shapeArray[0][3];

shapeArray[0][3] = shapeArray[3][3];

shapeArray[3][3] = shapeArray[3][0];

shapeArray[3][0] = tempCellVal;

tempCellVal = shapeArray[0][1];

shapeArray[0][1] = shapeArray[1][3];

shapeArray[1][3] = shapeArray[3][2];

shapeArray[3][2] = shapeArray[2][0];

shapeArray[2][0] = tempCellVal;

tempCellVal = shapeArray[0][2];

shapeArray[0][2] = shapeArray[2][3];

shapeArray[2][3] = shapeArray[3][1];

shapeArray[3][1] = shapeArray[1][0];

shapeArray[1][0] = tempCellVal;

tempCellVal = shapeArray[1][1];

shapeArray[1][1] = shapeArray[1][2];

shapeArray[1][2] = shapeArray[2][2];

shapeArray[2][2] = shapeArray[2][1];

shapeArray[2][1] = tempCellVal;

 

  1. If you are passing values in the intention of changing it, verify whether you are passing by value/reference. You need to tweak your steps depending on how you implement.

Introducing our Online Essay Writing Services Agency, where you can confidently place orders for a wide range of academic assignments. Our reputable homework writing company specializes in crafting essays, term papers, research papers, capstone projects, movie reviews, presentations, annotated bibliographies, reaction papers, research proposals, discussions, and various other assignments. Rest assured, our content is guaranteed to be 100% original, as every piece is meticulously written from scratch. Say goodbye to concerns about plagiarism and trust us to deliver authentic and high-quality work.

WRITE MY ESSAY NOW

PLACE YOUR ORDER