void choices()
{
     unsigned char choice;
     do
     {
     system("CLS");
     cout << "\n1. Single Player" << endl;
     cout << "2. Multi Player" << endl;
     cout << "3. Credits" << endl;
     cout << "4. Exit" << endl;
     cout << "Enter your choice: ";
     choice = getche();
     switch(choice)
     {
                     case '1':
                          singlePlayer();
                          break;
                     case '2':
                          multiPlayer();
                          break;
                     case '3':
                          credits();
                          break;
                     case '4':
                          exit(1);
                          break;
                     default:
                     cout << "\nInvalid Choice!" << endl;
                     system("PAUSE");
     }
     }while(choice != '4');
}
Exemple #2
0
void titleScreen() {
	ALLEGRO_BITMAP *title = NULL;
	title = al_load_bitmap("title.bmp");

	bool exit = false;
	while (!exit) {
		al_draw_bitmap(title, 0, 0, 0);
		al_flip_display();

		ALLEGRO_EVENT ev;
		al_wait_for_event(eventQueue, &ev); // Wait for event, be that a new frame or a key press.

		if (ev.type == ALLEGRO_EVENT_KEY_UP) { // If the event was a key being released...
			switch (ev.keyboard.keycode) {
			case ALLEGRO_KEY_1:
				singlePlayer();
				break;
			case ALLEGRO_KEY_2:
				multiPlayer();
				break;
			case ALLEGRO_KEY_3:
				config();
				break;
			}
		}
		if (ev.type == ALLEGRO_EVENT_KEY_DOWN && ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
			exit = true;
	}
	al_destroy_bitmap(title);
}
Exemple #3
0
int main() {
  // sfmlStart();
  // welcome message
  welcome();
  int choice;
  while (!(std::cin >> choice) || (choice != 1 && choice != 0)) {
    std::cout << "Invalid input, try again: ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
  }
  if (choice == 1)
    multiPlayer();
  else
    aiPlayer();
  return 0;
}
Exemple #4
0
/*Main Process */
void main()
{init();
 int n, count=1, c=0;
 while (count<=3)
	{n=getPassword();
	if (n==1)
		{++count;
		cout<<"\nIncorrect password. Try again";
		getch();
		}
	else
		count=4;
	}

 if ((count>3) && (n==1))
	{cout<<"Access Denied";
	exit(0);
	}
 Load();

 int n1, n2, n3,flag;
 char ch;

 flag=0;
 while (flag==0)
	{n1=intro1();
	if (n1==4)
		{flag=1;
			break;}
	else

		{n2=intro2(n1,c);
		{if(n2==4)
			{hlpMenu();
			 getch();}
		else if(n2==3)
			{PlayerStats();
			getch();}
		else if(n2==2)
			multiPlayer();
		else if(n2==1)
			singlePlayer();
		}}
		++c;
	}
	getch();
}