srand(time(NULL)) should only be called once in the entire run of your program. Put it early in main.
Look how much cleaner your code can look:
Code:
BOOL setAttr(WORD w) {
return SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), w);
}
void printat(int x, int y, const char *str) {
gotoxy(x, y);
printf("%s", str);
}
void Random(int x) {
if (x == 1)
ArrowShape[Arrow++] = "wsad"[rand() % 4];
system("cls");
setAttr(121);
int k;
for (k = 0; k < Arrow; k++) {
int x = 80 * (Arrow - k) * 8;
switch (ArrowShape[k]) {
case 'w':
printat(x, 17, "/\\");
printat(x, 18, "||");
printat(x, 19, "||");
break;
case 's':
printat(x, 17, "||");
printat(x, 18, "||");
printat(x, 19, "\\/");
break;
case 'a':
printat(x, 17, "/---");
printat(x, 18, "\\---");
break;
case 'd':
printat(x, 17, "---\\");
printat(x, 18, "---/");
break;
}
Sleep(200);
if (80 - (Arrow * 8) == 16)
GameOver();
}
}
I think you are asking how to remove the displayed arrow from the screen when the matching key (w,a,s,d) is pressed. You would need to remove that arrow from the ArrowShape array (presumably shifting the array contents over).
Is more than one arrow of the same direction allowed? Is it possible for more than 4 arrows to be displayed?