示例#1
0
void main()
{
	int menu;
	for (ciclo = 0; ciclo == 0)
	{

		cout << "0. Presentacion";
		cout << "1. Indicaciones";
		cout << "2. Juego";
		cout << "3. Salir";
		cin >> menu;
		switch (menu)
		{
			case 0: presentacion();
					breack();

			case 1: indicaciones();
					breack();

			case 2: juego();
					breack();

			case 3: salir();
				    breack();
		}
	}
}
示例#2
0
void menu()
{
    int op=-1, xm, ym, i, margin = 70;
    String opciones[] = {"Jugar", "Tienda", "Ayuda", "Créditos"};
    setbkcolor(0x0066F4);
    setfillstyle(1, 0x0066F4);
    setcolor(0x003988);
    settextstyle(2, HORIZ_DIR, 8);

    for(i=0; i<4; i++, margin+=50)
    {
        bar(WIDTH/2-textwidth(opciones[3])/2-5, HEIGHT/2+margin-10, WIDTH/2+textwidth(opciones[3])/2+5, HEIGHT/2+margin+textheight(opciones[3])+10);
        outtextxy(WIDTH/2-textwidth(opciones[i])/2, HEIGHT/2+margin, opciones[i]);
    }

    do
    {
        while(!ismouseclick(WM_LBUTTONDOWN));
        getmouseclick(WM_LBUTTONDOWN, xm, ym);
        margin = 70;
        for(i=0; i<4; i++, margin+=50)
            if(xm>WIDTH/2-textwidth(opciones[3])/2-5
               && xm<WIDTH/2+textwidth(opciones[0])/2-10
               && ym>HEIGHT/2+margin-10
               && ym<HEIGHT/2+margin+textheight(opciones[3])+10)
                {
                    op = i;
                    i=5;
                    break;
                }
    }while(op==-1);

    fflush(stdin);
    switch(op)
    {
        case 0:
            juego(3);
            break;
        case 1:
            tienda();
            break;
        case 2:
            ayuda();
            break;
        case 3:
            creditos();
            break;
    }
}
示例#3
0
int main(){

    char respuesta = 'S';

    printf ("Bienvenido al juego CRAPS\n\n");

    srand (SEMILLA); /*generador d numeros aleatorios*/
    /*bucle principal*/
    while (toupper(respuesta) != 'N'){
    	juego();
	printf ("\n¿Quieres jugar otra vez? (S/N)");
	scanf ("  %c", &respuesta);
	printf ("\n");
    }
    printf ("Adiós que te vaya bien");

	return EXIT_SUCCESS;
}
示例#4
0
文件: Main.cpp 项目: Esaud17/AmayaOS
void menu()
{
    char seleccion = '0';

    printf("=== ADIVINANDO 0.2 ===\n");
    printf("     === MENU ===\n\n");
    printf("1. Jugar\n");
    printf("2. Ayuda\n");
    printf("3. Salir\n\n");

    printf("Tu seleccion: ");
    seleccion = getchar();
    putchar(seleccion);

    if(seleccion == '1')
    {
    	juego();
    }
    else if(seleccion == '2')
    {
    	ayuda();
    }
    else if(seleccion == '3')
    {
        /*Adios !*/
        limpiar();
    	printf("Bye !\n");
    }
    else /*El juego se puede volver "Loco" y puede crashear...*/
    {
    	limpiar();
    	printf("Por favor, elija una opcion valida...\n\n");
	pause();
	limpiar();
    	menu();
    }
}
示例#5
0
文件: Main.cpp 项目: Esaud17/AmayaOS
int juego()
{
    /*Generamos el numero misterioso*/
    int numero = aleatorio();
    int intentos = 0;

    char talvezs[128];
    int talvez = 0;
    char qidn;
    int np_1 = numero - num1(1);
    int np_2 = numero + num1(2);


    if (np_1 < 0) {
	np_1 = 0;
    }
    if (np_2 > 100) {
	np_2 = 100;
    }

    do
    {
        limpiar();
        printf("Has hecho %d intentos.\n", intentos);
        printf("El numero misterioso esta entre %d y %d.\n\n", np_1, np_2);
	printf("Escribe 'e' para cerrar\n");

        printf("Tu propuesta: ");
	/* gets_s() es un fork de gets() que arregla sus fallos de seguridad */
        gets_s(talvezs, 128);
	if (talvezs[0] == 'e') {
	  limpiar();
    	  printf("Bye !\n");
	  return 0;
	}
	talvez = atoi(talvezs);
	

        intentos = intentos + 1;
    }while(talvez != numero);

    /*Adivino el numero !*/

    limpiar();
    printf("=== FELICIDADES ===\n");
    printf("  === GANASTE ===\n\n");
    printf("El numero era: %d\n\n", numero);
    printf("Lo intentaste: %d veces\n", intentos);
    printf("Quieres volver a jugar ? (S/n): ");
    qidn = getchar();
    putchar(qidn);

    if(qidn == 'S' || qidn == 's')
    {
        limpiar();
        juego();
    }
    else if(qidn == 'N' || qidn == 'n')
    {
        limpiar();
        menu();
    }
    else
    {
        limpiar();
        menu();
    }
    return 0;
}
示例#6
0
文件: main.cpp 项目: dexter1986/unli
int main()
{
	Game juego(600,800,"Alphabet Hero");
	juego.Go();
	return 0;
}
示例#7
0
int main(){

  printf("BIENVENIDO\n1)JUGAR SOLO \n2)JUGAR CON ALGUIEN\n");
  scanf("%d",&sol);


   for (int i=0;i<maxtan;i++){
      for (int j=0;j<maxtan;j++){
         matrix[j][i]=0;   
      }
    }


    for (int i=0;i<100;i++){
         matrix[(1+ (rand()% 10))][(1+ (rand()% maxtan))]=3;   
    }
      
      int pxp=maxtan-1;
      int pyp=(maxtan-1)/2;

       matrix[pxp][pyp]=8;



   //printf("\n PROGRAMA ESCRITO POR ACEVEDO!!!!!!!!!!!!!!!!\n");

   grafica();


  //###################canon#######################################
  int longitud= 5; 
  int salid=-1;
  
  int pfy=(pyp+(longitud-1));
  int pfx=(pxp-(longitud-1));
  
  printf("4+enter:izquierda\n6+enter:derecha\n0+enter:dispara\n\n");
 while(salid!=-2){

     int* sa = bresen(pyp,pxp,pfy,pfx);

    int j= 0; 
      for (int i = 0; i <longitud; i++){
        matrix[sa[j+1]][sa[j]]=4;
        j=j+2;
      }

    //printf("xf: %d,yf:%d\n",pfy,pfx );
    
    if(salid==4){
      j= 0;
      for (int i = 0; i <longitud; i++){
        matrix[sa[j+1]][sa[j]]=0;
        j=j+2;
      }

      rotacion(pyp,pxp,&pfy,&pfx,-1);
      printf("xf: %d,yf:%d\n",pfy,pfx );

      sa = bresen(pyp,pxp,pfy,pfx);

      j= 0; 
      for (int i = 0; i <longitud; i++){
        matrix[sa[j+1]][sa[j]]=4;
        j=j+2;
      }
    }

    if(salid==6){
      j= 0;
      for (int i = 0; i <longitud; i++){
        matrix[sa[j+1]][sa[j]]=0;
        j=j+2;
      }

      rotacion(pyp,pxp,&pfy,&pfx,5);
      printf("xf: %d,yf:%d\n",pfy,pfx );

      sa = bresen(pyp,pxp,pfy,pfx);

      j= 0; 
      for (int i = 0; i <longitud; i++){
        matrix[sa[j+1]][sa[j]]=4;
        j=j+2;
      }
    }

    if(salid==0){

       int vx=pfx-pxp;
       int vy=pfy-pyp;
       int sent=1;
      if(vx<0){
          sent=-1;
       }
      if (vx!=0){
          vx=vx*sent;
       }
       
       printf("\nvx %d\n",vx );
       printf("vy %d\n", vy);

       juego(sa[((longitud*2)-1)],sa[((longitud*2)-2)],vx,vy);
    }

    grafica();
    scanf("%d",&salid);
  }

return 0;
}