so i am having some problem

 x = 50; y = 31;                  //declaration from line 1 to 5

      lastx = x; lasty = y;
        while(1 == 1)


 gotoxy(lastx, lasty);
 printf("         ");
 a = getch();
 lastx = x; lasty = y;
 if (a == 77) x = x + 1;
 if (a == 75) x = x - 1;

 //i am facing problem here, i have these two codes but when i try to run only the character movement peice of code works, which is above this comment and the rand wont work which is below this comment.
 // so please help me how to make them work together, cause its a shooter game.. thanks

 while(1 == 1){
      printf("       ");
x1 = rand() % 3 + 50 ; y1 = 1;

thanks, though

4 Years
Discussion Span
Last Post by Suzie999

Not really much to look at there and a lot of missing code, but I can say that your top while loop never seems to be broken out of so your second while loop will never be entered into.

If you want both of them to loop at the same time, then you will need to run one in a separate thread or process, then you are heading into a whole new area.


i posted only a bit of code in which i need help, obvio i wont ppost the whole code.

could you please throw some light on how to make them run at the same time.

Edited by Vikram Sehgal


Then you will need to things in only the one loop.

Thing is, like I said it's difficult for people to advise properly with such a small amount of information.

Sorry I could not be of more help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.