From: Jay Slanker Newsgroups: rec.games.programmer,alt.msdos.programmer,comp.os.msdos.djgpp Subject: Text Mode Program: Help Please.. Date: Sun, 07 Sep 1997 15:59:33 -0500 Organization: AT&T WorldNet Services Lines: 67 Message-ID: <5uv4i5$t3u@bgtnsc02.worldnet.att.net> NNTP-Posting-Host: 207.146.213.36 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I am just trying to make a simple text mode, move around demo. Having a Zero move around the screen when you press 8(up), 6(right), 4(left), and 5(down). It compiles ok, but then when run, if you press any of the above keys it repeptitively prints the zero key until you end it(press escape). Please if anyone see's the problem in the following code, e-mail me at: slanker505 AT usa DOT net. Thanks in advance. Reply by e-mail please.. /* Begin Code */ #include #include #include main(){ int x_loc,y_loc; /* X and Y location of the zero */ char your_character,control; /* the zero and the variable to get the keypress */ your_character=48; /* Ascii code for zero 0 */ x_loc=10; /* Starting X location */ y_loc=10; /* Starting Y location */ clrscr(); /* Clear the screen */ gotoxy(x_loc,y_loc); printf("%c",your_character); do{ if(kbhit()) control=getch(); if(control=='8'){ clrscr(); --x_loc; gotoxy(x_loc,y_loc); printf("%c",your_character); } if(control=='4'){ clrscr(); --y_loc; gotoxy(x_loc,y_loc); printf("%c",your_character); } if(control=='6'){ clrscr(); ++y_loc; gotoxy(x_loc,y_loc); printf("%c",your_character); } if(control=='5'){ clrscr(); ++x_loc; gotoxy(x_loc,y_loc); printf("%c",your_character); } } while(control!=27); clrscr(); return 0; }