Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

continuation of assignment

For beginners, programming is often hard and frustrating. If a programmer can visualize what they are creating, it makes programming little less difficult. That is what you will do in this module.

You have already submitted the detailed design and game loop with all the dummy functions. During this module, implement one of the very first steps of Tetris, "Display the Bucket". You need to call the function inside the game loop so that it is always displayed. But, you might need to initialize it once before the game loop. Below you will find some detailed instruction on the bucket implementation.

  1. Bucket will be a 2-D array of char of 25 x 12 dimension.
  2. Fill the left border (column 1), right border (column 12), and bottom border (row 25) of the bucket with any char that you like to create the border with. Remember, the array index is '1' lower than the actual # of columns. This can be your "initializeBucket()" function. Fill the other cells with empty string ' '. You know that, to go over a 2-D array you need two nested for loops. Right? You also need conditional statements.
  3. Display the bucket in a game loop. How do you do that? You use two for loops and use a "cout....". You can name the function "displayBucket()".
  4. For Windows, use the "Windows.h" library. Use the function below to put your cursor, where you want to display something. Remember the top and left most location of the console is (0,0). So, if you want to draw from the top-left most, you call the function this way, "setCursorTo(0, 0);". Then do your 'cout << "etc etc ..."<<endl;' (see below). If you want to display at some other location, call "setCursorTo" for that location and do a cout again. You can do this "setCursorTo" and "cout<<...." combination as many times as you want. To give bucket a bucket shape, you need to use this "setCursorTo" function appropriately.

void setCursorTo(int x, int y){     HANDLE handle;     COORD position;     handle = GetStdHandle(STD_OUTPUT_HANDLE);     position.X = x;     position.Y = y;     SetConsoleCursorPosition(handle, position);}

Void main(){     setCursorTo(0, 0);     cout <<"etc etc ..."<<endl;}

  1. Here is how your bucket should look like after you finished the step. Notice, you have left border, right border, and bottom border, and everything inside is empty string.
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question