Race Game CG Project Source Code

Code is 100% error free
Still if you have any errors and if you don't know how to run code feel free to WhatsApp us or Comment below, Thank You.
 DOWNLOAD REPORT
DESCRIPTION

         Computer graphics (CG) simple race game is very simple to play and enjoy. This race game allows the users to change the console color according to their choice and looks so interesting and the menu options for this is given with green, red, blue and black colors. The user can also restart and quit the game whenever they feel to quit or restart using menu. For displaying the menu you  can use the mouse right button and also at the right side of the console the score and the speed is displayed.

KEYBOARD & MOUSE FUNCTIONS

  • Use W/w or S/s to move.
  • Use Spacebar to run.
SOME SOURCE CODE

void DrawAdversaries() {

	for(int i = 0; i< 3; i++){

		glPushMatrix();

			glTranslatef(0, tAY[i], 0);

			glBegin(GL_POLYGON);

				glVertex3f(aX[i], aY[i], 0);

				glVertex3f(aX[i]+4, aY[i], 0);

				glVertex3f(aX[i]+4, aY[i]+4, 0);

				glVertex3f(aX[i], aY[i]+4, 0);

			glEnd();

			

			glBegin(GL_POLYGON);

				glVertex3f(aX[i]+8.6, aY[i], 0);

				glVertex3f(aX[i]+12.6, aY[i], 0);

				glVertex3f(aX[i]+12.6, aY[i]+4, 0);

				glVertex3f(aX[i]+8.6, aY[i]+4, 0);

			glEnd();

			

			glBegin(GL_POLYGON);

				glVertex3f(aX[i]+4.3, aY[i]+4.3, 0);

				glVertex3f(aX[i]+8.3, aY[i]+4.3, 0);

				glVertex3f(aX[i]+8.3, aY[i]+8.3, 0);

				glVertex3f(aX[i]+4.3, aY[i]+8.3, 0);

			glEnd();



			glBegin(GL_POLYGON);

				glVertex3f(aX[i], aY[i]+8.6, 0);

				glVertex3f(aX[i]+4, aY[i]+8.6, 0);

				glVertex3f(aX[i]+4, aY[i]+12.6, 0);

				glVertex3f(aX[i], aY[i]+12.6, 0);

			glEnd();

			

			glBegin(GL_POLYGON);

				glVertex3f(aX[i]+4.3, aY[i]+8.6, 0);

				glVertex3f(aX[i]+8.3, aY[i]+8.6, 0);

				glVertex3f(aX[i]+8.3, aY[i]+12.6, 0);

				glVertex3f(aX[i]+4.3, aY[i]+12.6, 0);

			glEnd();

			

			glBegin(GL_POLYGON);

				glVertex3f(aX[i]+8.6, aY[i]+8.6, 0);

				glVertex3f(aX[i]+12.6, aY[i]+8.6, 0);

				glVertex3f(aX[i]+12.6, aY[i]+12.6, 0);

				glVertex3f(aX[i]+8.6, aY[i]+12.6, 0);

			glEnd();

			

			glBegin(GL_POLYGON);

				glVertex3f(aX[i]+4.3, aY[i]+12.9, 0);

				glVertex3f(aX[i]+8.3, aY[i]+12.9, 0);

				glVertex3f(aX[i]+8.3, aY[i]+16.9, 0);

				glVertex3f(aX[i]+4.3, aY[i]+16.9, 0);

			glEnd();

		glPopMatrix();

	}

}

Keyboard and mouse functions

  • Use <- to move left.
  • Use -> to move right.
  • Use mouse for more options.
Please Comment Your Reviews About the Code & Report Below.
Post a Comment (0)
Previous Post Next Post