Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: C Programming Help

  1. #1
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    Sup people. Ok, the galaga-type of game is due on monday. However, I'm having some serious trouble

    Here's the code

    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <dos.h>
    
    int x = 37;
    int y = 25;
    char b;
    
    
    void ship (int x, int y);
    void shoot (int x, int y);
    void menu ();
    void enemy();
    void salida ();
    
    
    void salida(){
    	clrscr();
    	delay(500);
    	printf("Gracias por jugar\n");
    	exit(0);
    }
    
    
    void enemy(int x, int y){
    	gotoxy(x,y);
    	printf("w0otage");
    
    }
    
    void shoot(int x, int y){
    	int i=21;
    	while (i>0){
      int ejex = x;
      gotoxy(ejex+3, i);
      printf("|");
      delay (14);
      i--;
    	
    	}
    	ship(x,y);
    
    }
    
    void ship(int x, int y){
    	clrscr();
    	gotoxy(x,y);
    	printf("*-----*");
    	gotoxy(x,y-1);
    	printf(" *---* ");
    	gotoxy(x,y-2);
    	printf("  *-*  ");
    	gotoxy(x,y-3);
    	printf("   *   ");
    
    
    	delay(3000);
    	enemy(x,y);
    	
    	b = getch();
    
    	switch (b){
    
      case 'a':
      	if(x<=5){
        ship(x,y);
      	}else {
        ship(x-7,y);
        }
      	break;
      	
        	
      case 'd':
      	if(x>=72){
        ship(x,y);
      	}else {
        ship(x+7,y);
        }
      	break;
      
      case 's':
      	shoot(x,y);
      	break;
      
      case 'm':
      	menu();
      	break;
    
      case 'z':
      	salida();
      	break;
    
      default:
      	ship(x,y);
    	}
    	
    }
    
    void menu(){
    
    	clrscr();
    	gotoxy(22,10);
    	printf("Izquierda  	A\n");
    	gotoxy(22,11);
    	printf("Disparar  	S\n");
    	gotoxy(22,12);
    	printf("Derecha    D\n");
    	gotoxy(22,13);
    	printf("Menu    M\n");
    	gotoxy(22,14);
    	printf("Salir    Z\n");
    	gotoxy(22,16);
    	printf("Para empezar a jugar, presione E\n");
    	gotoxy(22,17);
    	printf("Para salir, presione Z\n");
    
    	b = getch();
    
    	switch (b){
    
      case 'e':
      	ship(x,y);
      	break;
    	
      case 'z':
      	salida();
      	break;
    
      default:
      	menu();
        	
    	}
    
    }
    
    
    void main(){
    
    	menu();
    }
    As the last time, press E to play, A-D for left-right, S for shooting, M for menu, and Z for quitting. I compiled with borlandC 3.1

    So here's the problem:
    I'm trying to great the enemy ships. However, the problem is that the good ship (whenever it moves), it clears screen

    void ship(int x, int y){
    clrscr();
    gotoxy(x,y);
    So if I get the enemy ship to display, it would be erased whenever the ship does something.

    Any ideas on this? Please, I'm on a hurry :

  2. Software & Hardware   -   #2
    you are clearing the screen whenever the ship moves

    you may want to make it redraw the enemy ships after the god ship has been moved
    There are 10 types of people in the world those who understand binary and those who dont

  3. Software & Hardware   -   #3
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    Originally posted by ObiWan@7 February 2004 - 06:59
    you are clearing the screen whenever the ship moves

    you may want to make it redraw the enemy ships after the god ship has been moved
    Yeps, that's what I'm thinking. The question is how. Any ideas?

  4. Software & Hardware   -   #4
    call the draw enemy ship fuction from the ship function
    There are 10 types of people in the world those who understand binary and those who dont

  5. Software & Hardware   -   #5
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    Originally posted by ObiWan@7 February 2004 - 07:23
    call the draw enemy ship fuction from the ship function
    Ok I'm gonna try that right now. In the meantime, check what I did -

    In this version, I don't use clrscr, but just printf which erases the ship and then re-draws it somewhere

    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <dos.h>
    
    int x = 37;
    int y = 25;
    char b;
    
    
    void ship (int x, int y);
    void shoot (int x, int y);
    void menu ();
    void salida ();
    void centership(int x, int y);
    void borrar(int x, int y);
    void bala(int x, int y);
    
    void salida(){
    	clrscr();
    	delay(500);
    	printf("Gracias por jugar\n");
    	exit(0);
    }
    
    void borrar(int x, int y){
    	int i=21;
    	delay(15);
    	while (i>0){
      int ejex = x;
      gotoxy(ejex+3,i);
      printf(" ");
      delay (7);
      i--;
    	}
    	ship(x,y);
    
    }
    
    void bala (int x, int y){
    	int i=21;
    	while (i>0){
      int ejex = x;
      gotoxy(ejex+3,i);
      printf("|");
      delay (14);
      i--;
    	
    	}
    	borrar(x,y);
    	
    }
    
    
    void shoot(int x, int y){
    	bala(x,y);
    }
    
    void centership(int x, int y){
    	clrscr();
    	gotoxy(x,y);
    	printf("*-----*");
    	gotoxy(x,y-1);
    	printf(" *---* ");
    	gotoxy(x,y-2);
    	printf("  *-*  ");
    	gotoxy(x,y-3);
    	printf("   *   ");
    	ship(x,y);
    }
    
    void ship(int x, int y){
    
    	b = getch();
    
    	switch (b){
    
      case 'a':
      	if (x<=5){
      	}else {
        gotoxy(x,y);
        printf("       ");
        gotoxy(x,y-1);
        printf("       ");
        gotoxy(x,y-2);
        printf("       ");
        gotoxy(x,y-3);
        printf("       ");
        gotoxy(x-7,y);
        printf("*-----*");
        gotoxy(x-7,y-1);
        printf(" *---* ");
        gotoxy(x-7,y-2);
        printf("  *-*  ");
        gotoxy(x-7,y-3);
        printf("   *   ");
        ship(x-7,y);
        break;
      	}
        	
        	
      case 'd':
      	if (x>=72){
      	}else {
        gotoxy(x,y);
        printf("       ");
        gotoxy(x,y-1);
        printf("       ");
        gotoxy(x,y-2);
        printf("       ");
        gotoxy(x,y-3);
        printf("       ");
        gotoxy(x+7,y);
        printf("*-----*");
        gotoxy(x+7,y-1);
        printf(" *---* ");
        gotoxy(x+7,y-2);
        printf("  *-*  ");
        gotoxy(x+7,y-3);
        printf("   *   ");
        ship(x+7,y);
        break;
      	}	
      
      case 's':
      	shoot(x,y);
      	break;
      
      case 'm':
      	menu();
      	break;
    
      case 'z':
      	salida();
      	break;
    
      default:
      	ship(x,y);
    	}
    	
    }
    
    void menu(){
    
    	clrscr();
    	gotoxy(22,10);
    	printf("Izquierda  	A\n");
    	gotoxy(22,11);
    	printf("Disparar  	S\n");
    	gotoxy(22,12);
    	printf("Derecha    D\n");
    	gotoxy(22,13);
    	printf("Menu    M\n");
    	gotoxy(22,14);
    	printf("Salir    Z\n");
    	gotoxy(22,16);
    	printf("Para empezar a jugar, presione E\n");
    	gotoxy(22,17);
    	printf("Para salir, presione Z\n");
    
    	b = getch();
    
    	switch (b){
    
      case 'e':
      	centership(x,y);
      	break;
    	
      case 'z':
      	salida();
      	break;
    
      default:
      	menu();
        	
    	}
    
    }
    
    
    void main(){
    
    	menu();
    }
    Problem is, when I go to the left end, if I press A again to go left, it goes one space right, and when I go to the right side, if I press D to go right, it shoots

  6. Software & Hardware   -   #6
    try
    case 'a':
    if (x<=5){
    break;
    }else {
    gotoxy(x,y);

    and

    case &#39;d&#39;:
    if (x>=72){
    break;
    }else {
    gotoxy(x,y);
    There are 10 types of people in the world those who understand binary and those who dont

  7. Software & Hardware   -   #7
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    Originally posted by ObiWan@7 February 2004 - 08:03
    try
    case &#39;a&#39;:
    if (x<=5){
    break;
    }else {
    gotoxy(x,y);

    and

    case &#39;d&#39;:
    if (x>=72){
    break;
    }else {
    gotoxy(x,y);
    Will do right now....

    Bleh forgot to say I tried that. The problem is that if I do that, the game exits

  8. Software & Hardware   -   #8
    ive think ive got it
    Code:
    #include &#60;stdio.h&#62;
    #include &#60;conio.h&#62;
    #include &#60;stdlib.h&#62;
    #include &#60;dos.h&#62;
    
    int x = 37;
    int y = 25;
    char b;
    
    
    void ship &#40;int x, int y&#41;;
    void shoot &#40;int x, int y&#41;;
    void menu &#40;&#41;;
    void salida &#40;&#41;;
    void centership&#40;int x, int y&#41;;
    void borrar&#40;int x, int y&#41;;
    void bala&#40;int x, int y&#41;;
    
    void salida&#40;&#41;{
    clrscr&#40;&#41;;
    delay&#40;500&#41;;
    printf&#40;&#34;Gracias por jugar&#092;n&#34;&#41;;
    exit&#40;0&#41;;
    }
    
    void borrar&#40;int x, int y&#41;{
    int i=21;
    delay&#40;15&#41;;
    while &#40;i&#62;0&#41;{
     int ejex = x;
     gotoxy&#40;ejex+3,i&#41;;
     printf&#40;&#34; &#34;&#41;;
     delay &#40;7&#41;;
     i--;
    }
    ship&#40;x,y&#41;;
    
    }
    
    void bala &#40;int x, int y&#41;{
    int i=21;
    while &#40;i&#62;0&#41;{
     int ejex = x;
     gotoxy&#40;ejex+3,i&#41;;
     printf&#40;&#34;|&#34;&#41;;
     delay &#40;14&#41;;
     i--;
    
    }
    borrar&#40;x,y&#41;;
    
    }
    
    
    void shoot&#40;int x, int y&#41;{
    bala&#40;x,y&#41;;
    }
    
    void centership&#40;int x, int y&#41;{
    clrscr&#40;&#41;;
    gotoxy&#40;x,y&#41;;
    printf&#40;&#34;*-----*&#34;&#41;;
    gotoxy&#40;x,y-1&#41;;
    printf&#40;&#34; *---* &#34;&#41;;
    gotoxy&#40;x,y-2&#41;;
    printf&#40;&#34; &nbsp;*-* &nbsp;&#34;&#41;;
    gotoxy&#40;x,y-3&#41;;
    printf&#40;&#34; &nbsp; * &nbsp; &#34;&#41;;
    ship&#40;x,y&#41;;
    }
    
    void ship&#40;int x, int y&#41;{
    
    b = getch&#40;&#41;;
    
    switch &#40;b&#41;{
    
     case &#39;a&#39;&#58;
     &nbsp;if &#40;x&#60;=5&#41;{
     &nbsp;ship&#40;x,y&#41;;
     &nbsp;break;
     &nbsp;}else {
     &nbsp; gotoxy&#40;x,y&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-1&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-2&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-3&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x-7,y&#41;;
     &nbsp; printf&#40;&#34;*-----*&#34;&#41;;
     &nbsp; gotoxy&#40;x-7,y-1&#41;;
     &nbsp; printf&#40;&#34; *---* &#34;&#41;;
     &nbsp; gotoxy&#40;x-7,y-2&#41;;
     &nbsp; printf&#40;&#34; &nbsp;*-* &nbsp;&#34;&#41;;
     &nbsp; gotoxy&#40;x-7,y-3&#41;;
     &nbsp; printf&#40;&#34; &nbsp; * &nbsp; &#34;&#41;;
     &nbsp; ship&#40;x-7,y&#41;;
     &nbsp; break;
     &nbsp;}
    
    
     case &#39;d&#39;&#58;
     &nbsp;if &#40;x&#62;=72&#41;{
     &nbsp;ship&#40;x,y&#41;;
     &nbsp;break;
     &nbsp;}else {
     &nbsp; gotoxy&#40;x,y&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-1&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-2&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-3&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x+7,y&#41;;
     &nbsp; printf&#40;&#34;*-----*&#34;&#41;;
     &nbsp; gotoxy&#40;x+7,y-1&#41;;
     &nbsp; printf&#40;&#34; *---* &#34;&#41;;
     &nbsp; gotoxy&#40;x+7,y-2&#41;;
     &nbsp; printf&#40;&#34; &nbsp;*-* &nbsp;&#34;&#41;;
     &nbsp; gotoxy&#40;x+7,y-3&#41;;
     &nbsp; printf&#40;&#34; &nbsp; * &nbsp; &#34;&#41;;
     &nbsp; ship&#40;x+7,y&#41;;
     &nbsp; break;
     &nbsp;}
    
     case &#39;s&#39;&#58;
     &nbsp;shoot&#40;x,y&#41;;
     &nbsp;break;
    
     case &#39;m&#39;&#58;
     &nbsp;menu&#40;&#41;;
     &nbsp;break;
    
     case &#39;z&#39;&#58;
     &nbsp;salida&#40;&#41;;
     &nbsp;break;
    
     default&#58;
     &nbsp;ship&#40;x,y&#41;;
    }
    
    }
    
    void menu&#40;&#41;{
    
    clrscr&#40;&#41;;
    gotoxy&#40;22,10&#41;;
    printf&#40;&#34;Izquierda &nbsp; A&#092;n&#34;&#41;;
    gotoxy&#40;22,11&#41;;
    printf&#40;&#34;Disparar &nbsp; S&#092;n&#34;&#41;;
    gotoxy&#40;22,12&#41;;
    printf&#40;&#34;Derecha &nbsp; &nbsp;D&#092;n&#34;&#41;;
    gotoxy&#40;22,13&#41;;
    printf&#40;&#34;Menu &nbsp; &nbsp;M&#092;n&#34;&#41;;
    gotoxy&#40;22,14&#41;;
    printf&#40;&#34;Salir &nbsp; &nbsp;Z&#092;n&#34;&#41;;
    gotoxy&#40;22,16&#41;;
    printf&#40;&#34;Para empezar a jugar, presione E&#092;n&#34;&#41;;
    gotoxy&#40;22,17&#41;;
    printf&#40;&#34;Para salir, presione Z&#092;n&#34;&#41;;
    
    b = getch&#40;&#41;;
    
    switch &#40;b&#41;{
    
     case &#39;e&#39;&#58;
     &nbsp;centership&#40;x,y&#41;;
     &nbsp;break;
    
     case &#39;z&#39;&#58;
     &nbsp;salida&#40;&#41;;
     &nbsp;break;
    
     default&#58;
     &nbsp;menu&#40;&#41;;
     &nbsp; &nbsp;
    }
    
    }
    
    
    void main&#40;&#41;{
    
    menu&#40;&#41;;
    }
    its
    case &#39;a&#39;:
    if (x<=5){
    ship(x,y);
    break;
    }else {
    gotoxy(x,y);
    There are 10 types of people in the world those who understand binary and those who dont

  9. Software & Hardware   -   #9
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    L33t. Hehe, that works

    Thanks B)

  10. Software & Hardware   -   #10
    BANNED
    Join Date
    Jul 2003
    Location
    Guatemala
    Posts
    4,044
    Ok, modified the code again:

    Code:
    #include &#60;stdio.h&#62;
    #include &#60;conio.h&#62;
    #include &#60;stdlib.h&#62;
    #include &#60;dos.h&#62;
    
    int x = 37;
    int y = 25;
    char b;
    
    
    void ship &#40;int x, int y&#41;;
    void shoot &#40;int x, int y&#41;;
    void menu &#40;&#41;;
    void salida &#40;&#41;;
    void centership&#40;int x, int y&#41;;
    void borrar&#40;int x, int y&#41;;
    void bala&#40;int x, int y&#41;;
    void draw_ship&#40;int x, int y&#41;;
    void erase_ship&#40;int x, int y&#41;;
    
    void salida&#40;&#41;{
     &nbsp;clrscr&#40;&#41;;
     &nbsp;delay&#40;500&#41;;
     &nbsp;printf&#40;&#34;Gracias por jugar&#092;n&#34;&#41;;
     &nbsp;exit&#40;0&#41;;
    }
    
    void erase_ship&#40;int x, int y&#41;{
     &nbsp; gotoxy&#40;x,y&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-1&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-2&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-3&#41;;
     &nbsp; printf&#40;&#34; &nbsp; &nbsp; &nbsp; &#34;&#41;;
    }
    
    void draw_ship&#40;int x, int y&#41;{
     &nbsp; gotoxy&#40;x,y&#41;;
     &nbsp; printf&#40;&#34;*-----*&#34;&#41;;
     &nbsp; gotoxy&#40;x,y-1&#41;;
     &nbsp; printf&#40;&#34; *---* &#34;&#41;;
     &nbsp; gotoxy&#40;x,y-2&#41;;
     &nbsp; printf&#40;&#34; &nbsp;*-* &nbsp;&#34;&#41;;
     &nbsp; gotoxy&#40;x,y-3&#41;;
     &nbsp; printf&#40;&#34; &nbsp; * &nbsp; &#34;&#41;;
    }
    
    void borrar_bala&#40;int x, int y&#41;{
     &nbsp;int i=21;
     &nbsp;delay&#40;15&#41;;
     &nbsp;while &#40;i&#62;0&#41;{
     &nbsp; &nbsp;int ejex = x;
     &nbsp; &nbsp;gotoxy&#40;ejex+3,i&#41;;
     &nbsp; &nbsp;printf&#40;&#34; &#34;&#41;;
     &nbsp; &nbsp;delay &#40;7&#41;;
     &nbsp; &nbsp;i--;
     &nbsp;}
     &nbsp;ship&#40;x,y&#41;;
    
    }
    
    void bala &#40;int x, int y&#41;{
     &nbsp;int i=21;
     &nbsp;while &#40;i&#62;0&#41;{
     &nbsp; &nbsp;int ejex = x;
     &nbsp; &nbsp;gotoxy&#40;ejex+3,i&#41;;
     &nbsp; &nbsp;printf&#40;&#34;|&#34;&#41;;
     &nbsp; &nbsp;delay &#40;14&#41;;
     &nbsp; &nbsp;i--;
     &nbsp;
     &nbsp;}
     &nbsp;borrar_bala&#40;x,y&#41;;
     &nbsp;
    }
    
    
    void shoot&#40;int x, int y&#41;{
     &nbsp;bala&#40;x,y&#41;;
    }
    
    void centership&#40;int x, int y&#41;{
     &nbsp;clrscr&#40;&#41;;
     &nbsp;gotoxy&#40;x,y&#41;;
     &nbsp;printf&#40;&#34;*-----*&#34;&#41;;
     &nbsp;gotoxy&#40;x,y-1&#41;;
     &nbsp;printf&#40;&#34; *---* &#34;&#41;;
     &nbsp;gotoxy&#40;x,y-2&#41;;
     &nbsp;printf&#40;&#34; &nbsp;*-* &nbsp;&#34;&#41;;
     &nbsp;gotoxy&#40;x,y-3&#41;;
     &nbsp;printf&#40;&#34; &nbsp; * &nbsp; &#34;&#41;;
     &nbsp;ship&#40;x,y&#41;;
    }
    
    void ship&#40;int x, int y&#41;{
    
     &nbsp;b = getch&#40;&#41;;
    
     &nbsp;switch &#40;b&#41;{
    
     &nbsp; &nbsp;case &#39;a&#39;&#58;
     &nbsp; &nbsp; &nbsp;if &#40;x&#62;5&#41;{
     &nbsp; &nbsp; &nbsp; &nbsp;erase_ship&#40;x,y&#41;;
     &nbsp; &nbsp; &nbsp; &nbsp;x -= 7;
     &nbsp; &nbsp; &nbsp; &nbsp;draw_ship&#40;x,y&#41;;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; &nbsp; &nbsp;break;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp; &nbsp;case &#39;d&#39;&#58;
     &nbsp; &nbsp; &nbsp;if &#40;x&#60;72&#41;{
     &nbsp; &nbsp; &nbsp; &nbsp;erase_ship&#40;x,y&#41;;
     &nbsp; &nbsp; &nbsp; &nbsp;x += 7;
     &nbsp; &nbsp; &nbsp; &nbsp;draw_ship&#40;x,y&#41;;
     &nbsp; &nbsp; &nbsp;}
     &nbsp; &nbsp; &nbsp;break;
     &nbsp; &nbsp;
     &nbsp; &nbsp;case &#39;s&#39;&#58;
     &nbsp; &nbsp; &nbsp;shoot&#40;x,y&#41;;
     &nbsp; &nbsp; &nbsp;break;
     &nbsp; &nbsp;
     &nbsp; &nbsp;case &#39;m&#39;&#58;
     &nbsp; &nbsp; &nbsp;menu&#40;&#41;;
     &nbsp; &nbsp; &nbsp;break;
    
     &nbsp; &nbsp;case &#39;z&#39;&#58;
     &nbsp; &nbsp; &nbsp;salida&#40;&#41;;
     &nbsp; &nbsp; &nbsp;break;
    
     &nbsp; &nbsp;default&#58;
     &nbsp; &nbsp; &nbsp;ship&#40;x,y&#41;;
     &nbsp;}
     &nbsp;
    }
    
    void menu&#40;&#41;{
    
     &nbsp;clrscr&#40;&#41;;
     &nbsp;gotoxy&#40;22,10&#41;;
     &nbsp;printf&#40;&#34;Izquierda &nbsp; &nbsp; &nbsp;A&#092;n&#34;&#41;;
     &nbsp;gotoxy&#40;22,11&#41;;
     &nbsp;printf&#40;&#34;Disparar &nbsp; &nbsp; &nbsp;S&#092;n&#34;&#41;;
     &nbsp;gotoxy&#40;22,12&#41;;
     &nbsp;printf&#40;&#34;Derecha &nbsp; &nbsp; &nbsp; &nbsp;D&#092;n&#34;&#41;;
     &nbsp;gotoxy&#40;22,13&#41;;
     &nbsp;printf&#40;&#34;Menu &nbsp; &nbsp; &nbsp; &nbsp;M&#092;n&#34;&#41;;
     &nbsp;gotoxy&#40;22,14&#41;;
     &nbsp;printf&#40;&#34;Salir &nbsp; &nbsp; &nbsp; &nbsp;Z&#092;n&#34;&#41;;
     &nbsp;gotoxy&#40;22,16&#41;;
     &nbsp;printf&#40;&#34;Para empezar a jugar, presione E&#092;n&#34;&#41;;
     &nbsp;gotoxy&#40;22,17&#41;;
     &nbsp;printf&#40;&#34;Para salir, presione Z&#092;n&#34;&#41;;
    
     &nbsp;b = getch&#40;&#41;;
    
     &nbsp;switch &#40;b&#41;{
    
     &nbsp; &nbsp;case &#39;e&#39;&#58;
     &nbsp; &nbsp; &nbsp;centership&#40;x,y&#41;;
     &nbsp; &nbsp; &nbsp;break;
     &nbsp;
     &nbsp; &nbsp;case &#39;z&#39;&#58;
     &nbsp; &nbsp; &nbsp;salida&#40;&#41;;
     &nbsp; &nbsp; &nbsp;break;
    
     &nbsp; &nbsp;default&#58;
     &nbsp; &nbsp; &nbsp;menu&#40;&#41;;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     &nbsp;}
    
    }
    
    
    void main&#40;&#41;{
    
     &nbsp;menu&#40;&#41;;
    }
    Does the same thing, but got rid of the clrscr. Any ideas for the enemies?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •