home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 26
/
CD_ASCQ_26_1295.iso
/
vrac
/
volume_3.zip
/
CAR.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-03
|
4KB
|
188 lines
#include "c:\tc\mouse.h"
#include "c:\tc\keyboard.h"
#include "c:\tc\graphvga.h"
#include "c:\tc\pcx.cpp"
struct Fire
{
int Bullet_X;
int Bullet_Y;
int Bullet_Length;
int Bullet_Height;
int Bullet_Display;
};
int main(void)
{
Fire Bullet1;
Fire Bullet2;
Fire Bullet3;
Bullet1.Bullet_Display = FALSE;
Bullet2.Bullet_Display = FALSE;
Bullet3.Bullet_Display = FALSE;
int Bullets = FALSE;
char char_ch = NULL;
int Scan1,Alt_Ctrl = NULL;
int int_ch;
int X,Y,tempX,tempY;
int Button_Check;
int coun,coun2,coun3;
InitGraphics(9);//Initialize graphics to graphics mode. See function
Detect_Mouse(); //Checks to see if mouse is present and sets MousePresent to TRUE or FALSE
Cursor_Shape(1);
Display_Mouse();
Move_Mouse(200,470);//Moves mouse to new X,Y position.
Display_PCX("Space.pcx");
Vert_Mouse_Limit(450,470); //Sets Mouse Y limits of movement
Horiz_Mouse_Limit(10,630);//Sets Mouse X limits of movement
setwritemode(XOR_PUT);
while((int_ch = Key_Press(&char_ch,&Scan1,&Alt_Ctrl)) != ESC)
{
if(Bullet1.Bullet_Display == TRUE)
{
coun++;
if(coun > 5)
{
//Erases Bullet
line(Bullet1.Bullet_X,Bullet1.Bullet_Y,Bullet1.Bullet_X,Bullet1.Bullet_Y-10);
Bullet1.Bullet_Y--;
Bullet1.Bullet_Y--;
//Draws Bullet
line(Bullet1.Bullet_X,Bullet1.Bullet_Y,Bullet1.Bullet_X,Bullet1.Bullet_Y-10);
if(Bullet1.Bullet_Y < 2)
{
//Erases Bullet
line(Bullet1.Bullet_X,Bullet1.Bullet_Y,Bullet1.Bullet_X,Bullet1.Bullet_Y-10);
Bullet1.Bullet_Display =FALSE;
Bullet1.Bullet_Y = Max_Y;
}
coun = 0;
}
}
if(Bullet2.Bullet_Display == TRUE)
{
coun2++;
if(coun2 > 5)
{
line(Bullet2.Bullet_X,Bullet2.Bullet_Y,Bullet2.Bullet_X,Bullet2.Bullet_Y-10);
Bullet2.Bullet_Y--;
Bullet2.Bullet_Y--;
line(Bullet2.Bullet_X,Bullet2.Bullet_Y,Bullet2.Bullet_X,Bullet2.Bullet_Y-10);
if(Bullet2.Bullet_Y < 12)
{
line(Bullet2.Bullet_X,Bullet2.Bullet_Y,Bullet2.Bullet_X,Bullet2.Bullet_Y-10);
Bullet2.Bullet_Display =FALSE;
Bullet2.Bullet_Y = Max_Y;
}
coun2=0;
}
}
if(Bullet3.Bullet_Display == TRUE)
{
coun++;
if(coun > 5)
{
//Erases Bullet
line(Bullet3.Bullet_X,Bullet3.Bullet_Y,Bullet3.Bullet_X,Bullet3.Bullet_Y-10);
Bullet3.Bullet_Y--;
Bullet3.Bullet_Y--;
//Draws Bullet
line(Bullet3.Bullet_X,Bullet3.Bullet_Y,Bullet3.Bullet_X,Bullet3.Bullet_Y-10);
if(Bullet3.Bullet_Y < 2)
{
//Erases Bullet
line(Bullet3.Bullet_X,Bullet3.Bullet_Y,Bullet3.Bullet_X,Bullet3.Bullet_Y-10);
Bullet3.Bullet_Display =FALSE;
Bullet3.Bullet_Y = Max_Y;
}
coun = 0;
}
}
Mouse_Position(&X,&Y);//Returns current mouse X,Y position
if(!Mouse_Status()) Bullets = FALSE;//Checks to see if any mouse buttons held down
if( (Bullet1.Bullet_Display == FALSE) AND (Bullets != TRUE) )
{
if( Button_Press_XY(&tempX,&tempY,Button_Check) )
{
if((Y != tempY) AND (X != tempX))
{
Bullet1.Bullet_Y = Y - 19;
Bullet1.Bullet_X = X-1;
Bullet1.Bullet_Display =TRUE;
line(Bullet1.Bullet_X,Bullet1.Bullet_Y,Bullet1.Bullet_X,Bullet1.Bullet_Y-10);
Bullets = TRUE;
}
}
}
if( (Bullet2.Bullet_Display == FALSE) AND (Bullets != TRUE) )
{
if( Button_Press_XY(&tempX,&tempY,Button_Check) )
{
if((Y != tempY) AND (X != tempX))
{
Bullet2.Bullet_Y = Y - 19;
Bullet2.Bullet_X = X-1;
Bullet2.Bullet_Display =TRUE;
line(Bullet2.Bullet_X,Bullet2.Bullet_Y,Bullet2.Bullet_X,Bullet2.Bullet_Y-10);
Bullets = TRUE;
}
}
}
if( (Bullet3.Bullet_Display == FALSE) AND (Bullets != TRUE) )
{
if( Button_Press_XY(&tempX,&tempY,Button_Check) )
{
if((Y != tempY) AND (X != tempX))
{
Bullet3.Bullet_Y = Y - 19;
Bullet3.Bullet_X = X-1;
Bullet3.Bullet_Display =TRUE;
line(Bullet3.Bullet_X,Bullet3.Bullet_Y,Bullet3.Bullet_X,Bullet3.Bullet_Y-10);
Bullets = TRUE;
}
}
}
}//End While
closegraph();
return int_ch;
}