/* * LUGS in 2D, a BUGS creation * by zorgo * * uses the Linux vgalib */ #include #include #define MAXLUG 100 /* Maximum amount of Lugs */ #define HISTORY 5 /* how big is our memory? */ #define GORGED 4 /* Color for feelings */ #define CONTENT 10 /* Brt Green */ #define HUNGRY 6 /**/ #define STARVING 8 /* Grey */ #define AGITATED 7 /* White */ int size_of_lugs; int number_of_lugs; int click; /******* The Structure of a Lug *********/ typedef struct _lug { int x, y, old_x[HISTORY], old_y[HISTORY], old_size[HISTORY], size, speed, color, direction, duration, feeling; /* color per feelings */ } LUG; LUG lug[MAXLUG]; /************************************************/ main() { int count; printf("Welcome to lugs.c\n\n"); do { printf("Total number of lugs? [MAX=%d] ",MAXLUG ); scanf("%d", &number_of_lugs); } while( number_of_lugs > MAXLUG); printf("\nSize of lugs? "); scanf("%d", &size_of_lugs); printf("\nHow many clicks? "); scanf("%d", &click); printf("Press a key to begin\n"); getchar(); initialize(); create_lugs(); for(count=0; count< click; count++) { lugs(); } getchar(); vga_setmode(TEXT); printf("End of lugs.c\n"); } /****************************************************/ create_lugs() { register int i; for(i=0; i 640) lug[i].x = 0; if(lug[i].x < 0 ) lug[i].x = 640; if(lug[i].y > 480) lug[i].y = 0; if(lug[i].y < 0) lug[i].y = 480; if(lug[i].color > 16) lug[i].color = 1; if(lug[i].color < 1 ) lug[i].color = 15; /******************** Check for collision ************************/ for(j=0; j