Originally Posted by
dwks
Ok, will do.
Code:
_setcursortype(_NOCURSOR);
Are you using DJGPP?
Not using DJPP, using Turbo C++ 3 for Dos. Normally the cursor draws the smiley and positions the blinking cursor next to it, i set it of so it doesn't look like that.
I changed it around to where I have a for loop printing a number to infinite then go to the move function, which has another print function so I see its getting that far, and its drawing the smiley, but its not processing any input after that so you can't move.
Code:
#include <stdlib.h>
#include <conio.h>
void main_move(void);
int choose, x, xa, y, ya, z, b, a;
int main(void)
{
x = 40;
y = 13;
z = 0;
b = 1;
a = 0;
xa = x;
ya = y;
clrscr();
while(z!=1) {
gotoxy(1,1);
printf("%d",b);
b++;
main_move(); }
clrscr();
exit(0);
}
void main_move(void)
{
gotoxy(5,5);
printf("%d",a);
a++;
gotoxy(xa,ya);
textcolor(WHITE);
textbackground(BLACK);
cprintf(" ");
gotoxy(x,y);
textcolor(WHITE);
textbackground(BLACK);
cprintf("");
_setcursortype(_NOCURSOR);
choose = getc();
switch (choose)
{
case 'q':
case 'Q':
case 27 : _setcursortype(_NORMALCURSOR); clrscr(); z = 1;
case 'w':
case 'W':
case 72 : if(y>2) {--y; ya= y+1;xa=x;} else {y=2; cprintf("\a");} break;
case 's':
case 'S':
case 80 : if(y<24){++y; ya= y-1;xa=x;} else {y=24; cprintf("\a");} break;
case 'a':
case 'A':
case 75 : if(x>1) {--x; xa= x+1;ya=y;} else {x=1; cprintf("\a");} break;
case 'd':
case 'D':
case 77 : if(x<80){++x; xa= x-1;ya=y;} else {x=80;cprintf("\a");} break;
}
}