mirror of
https://github.com/abakh/nbsdgames.git
synced 2024-12-04 14:46:22 -05:00
Improved controls
This commit is contained in:
parent
0a7b636854
commit
f8eb47bbcc
@ -133,7 +133,7 @@ void showscores(byte playerrank){
|
|||||||
move(3,0);
|
move(3,0);
|
||||||
byte b=0;
|
byte b=0;
|
||||||
if ( fscanf(scorefile,"%s : %ld\n",formername,&formerscore)==2){
|
if ( fscanf(scorefile,"%s : %ld\n",formername,&formerscore)==2){
|
||||||
halfdelay(2);
|
halfdelay(1);
|
||||||
printw("*****CONGRATULATIONS!****\n");
|
printw("*****CONGRATULATIONS!****\n");
|
||||||
printw(" You bet the\n");
|
printw(" You bet the\n");
|
||||||
printw(" previous\n");
|
printw(" previous\n");
|
||||||
@ -389,7 +389,7 @@ int main(int argc, char** argv){
|
|||||||
px=wid/2;
|
px=wid/2;
|
||||||
memset(board,0,len*wid);
|
memset(board,0,len*wid);
|
||||||
place_food(board);
|
place_food(board);
|
||||||
int input;
|
int preinput,input=0;
|
||||||
while(1){
|
while(1){
|
||||||
erase();
|
erase();
|
||||||
logo();
|
logo();
|
||||||
@ -423,6 +423,7 @@ int main(int argc, char** argv){
|
|||||||
if(px<0 || px>=wid)
|
if(px<0 || px>=wid)
|
||||||
break;
|
break;
|
||||||
halfspeed=!halfspeed;
|
halfspeed=!halfspeed;
|
||||||
|
preinput=input;
|
||||||
input = getch();
|
input = getch();
|
||||||
if( input == KEY_F(1) || input=='?' )
|
if( input == KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
@ -456,9 +457,11 @@ int main(int argc, char** argv){
|
|||||||
halfdelay(1);
|
halfdelay(1);
|
||||||
}
|
}
|
||||||
if(input!=ERR){
|
if(input!=ERR){
|
||||||
|
if(preinput==input){//if it wasn't there, hitting two keys in less than 0.1 sec would not work
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
flushinp();
|
flushinp();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(direction==UP && halfspeed){
|
if(direction==UP && halfspeed){
|
||||||
if(!py)
|
if(!py)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user