Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a program about a game (dinogame), could you please help me with this program, I badly need it. thank you Instruction: Construct a

This is a program about a game (dinogame), could you please help me with this program, I badly need it. thank you

Instruction: Construct a flowchart of this program. Thank you

*Note: I'm using Dev-C++

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
dinogame.cpp #include #include #include #include #define dinoPos 2 #define hurdlePos 74 using namespace std; 10 11 HANDLE console = GetStdHandle (STD_OUTPUT_HANDLE) ; 12 COORD CursorPosition; 13 14 int dinoY; 15 int speed = 40; 16 int gameover = 0; 17 18 _ void gotoxy (int x, int y) { 19 COORD coord; 20 coord.X = x; 21 coord . Y = yj 22 SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), coord) ; 23 24 25 void setcursor(bool visible, DWORD size) { 26 - if (size == 0) { 27 size = 20; // default cursor size Changing to numbers from 1 to 20, decreases cursor width 28 29 CONSOLE_CURSOR_INFO 1pCursor; 30 1pCursor . bVisible = visible; 31 1pCursor . dwSize = size; 32 SetConsoleCursorInfo (console, & lpCursor); 33 3435 _ void init() { 36 system ("cls") ; 37 gameover = 0; 38 gotoxy (3, 2); cout 20) 115 speed - - ; 116 117 118 ) void play (){ 119 system ("cls") ; 120 char ch; 121 int i; 122 init() ; 123 while (true) { 124 OOO while (!kbhit()) { 125 if ( gameover==1 ){ 126 return; 127 128 moveDino ( ) ; 129 drawHurdle () ; 130 131 ch = getch() ; 132 - if (ch == 32) { 133 i = 0; 134 - while( i 0) { 140 moveDino (2) ; 141 drawHurdle ( ) ; 142 i-- ; 143 144 145 else if (ch == 'p'| |ch= ='p") 146 getch () ; 147 else if (ch == 27) 148 break ; 149 150 151 152 _ void instructions () { 153 system ("cls") ; 154 cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Describe aspects in conducting feasibility studies for new business

Answered: 1 week ago