diff --git a/darrt.c b/darrt.c index 0951d76..fd02839 100644 --- a/darrt.c +++ b/darrt.c @@ -60,6 +60,9 @@ aim aims[26]; aim landed_aims[SHOTS_WHEN_STARTING];//so an aim couldn't pass below one that has already landed, doesn't make sense visually. byte shots,aims_to_stop; + +char msg[150]={0}; +byte msg_show=0; byte digit_count(int num){ byte ret=0; do{ @@ -89,7 +92,7 @@ void red_border(void){ void fill_aims(){ for(byte i=0;i<26;++i){ - aims[i].y= randint(0,HLEN); + aims[i].y= randint(8,HLEN); aims[i].x= randint(0,HWID); aims[i].angle=randint(0,628)/100; aims[i].v=1; @@ -122,6 +125,19 @@ void aim_lands(aim *a){ --aims_to_stop; score+=calculate_points(a); a->visible=0; + + float distance= center_distance((byte)a->y,(byte)a->x); + if((byte)a->y==HLEN && (byte)a->x==HWID){ + strcpy(msg,"Bravo!"); + } + else if(distance<2){ + strcpy(msg,"Very close..."); + } + else{ + goto NoMessage; + } + msg_show=30; + NoMessage: return; } void move_aim(aim *a){ if(a->brake==1){ @@ -244,44 +260,27 @@ void draw(){ for(byte i=0;i<26;++i){ draw_aim(aims[i]); } + if(msg_show){ + --msg_show; + mvaddstr(LEN-1,0,msg); + } } -void end_animation(){ +void end_scene(){ for(byte y=0;yHLEN){ - points=-2*pow(2,distance-HLEN); - } - else{ - points=pow(2,HLEN-distance); - } - score+=points; - bold=(int)(aims[i].x/4+ i*distance)%2;//so numbers displayed don't mix - mvprintw(5,0,"Score: %d",score); - attron(colors[2]|(A_BOLD*bold)); - mvprintw(aims[i].y,aims[i].x,"%d",points); - attroff(colors[2]|(A_BOLD*bold)); - refresh(); - usleep(500000); - } + logo(); + mvprintw(5,0,"Score: %d",score); + for(byte i=0;i