1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include <iostream>
#include <graphics.h>
#include <time.h>
using namespace std;
int main()
{
int rcolor,y=0 ;
srand(time(NULL));
initwindow(500 , 700 , "");
int LY = 700,circle_x=250,cy,circler=45;
//Intro
setcolor(10);
settextstyle(COMPLEX_FONT , HORIZ_DIR , 200);
outtextxy(100, 285, "SRGP\n");
setcolor(12);
settextstyle(GOTHIC_FONT , HORIZ_DIR , 47);
outtextxy(100 , 300 , "GAME");
delay(2000);
cleardevice();
char ch;
for(int i=1 ; i<=40 ; i++)
{
rcolor= rand()%(6-4+1)+4;
y=0;
for( ; y!=655 ;y+=5 )
{
setcolor(0);
circle(circle_x , y , circler);
setcolor(rcolor);
circle(circle_x , y , circler);
ch=getch();
if(ch == 'A' || ch == 'a'&&circle_x!=100)
{
setcolor(0);
circle(circle_x , y , circler);
circle_x=circle_x-150;
}
else if(ch == 'D' || ch == 'd'&&circle_x!=400)
{
setcolor(0);
circle(circle_x , y , circler);
circle_x=circle_x+150;
}
setcolor(0);
circle(circle_x , y , circler);
}
if((45+y) == LY)
{
LY = LY - 2*circler;
}
setcolor(rcolor);
circle(circle_x,y,circler);
}
getch();
return 0;
}
|