Esempio n. 1
0
void Screen_game::draw(string gender, float rotate, bool leftside, bool rightside){
    
    background.draw(Left, Right);
    
    timeline();
    lives(gender);
    
    Left = leftside;
    Right = rightside;
    
    if(Left) rotation = -(rotate*122);
    if(Right) rotation = rotate*120;
    
    if(gender == "boy"){
        
        if(fabs(rotation) > 50.0 || robotFalling){
            robotFalling = true;
            boy_fell();
        }else{
            boy();
            prevRotation = rotation;
            fallPositionX = 0;
            fallPositionY = 0;
            
            if(new_num_lives <= 0){
                background.timer = 0;
                background.pause = 0;
                background.init();
            }
            
            if(num_lives > new_num_lives) num_lives = new_num_lives;
        }
        
    }else{
        
        if(fabs(rotation) > 50.0 || robotFalling){
            robotFalling = true;
            girl_fell();
        }else{
            girl();
            prevRotation = rotation;
            fallPositionX = 0;
            fallPositionY = 0;
            
            if(new_num_lives <= 0){
                background.timer = 0;
                background.pause = 0;
                background.init();
            }
            
            if(num_lives > new_num_lives) num_lives = new_num_lives;
            
            
        }
        
    }
    
}
Esempio n. 2
0
int main()
{
    double SPI[8] = {1, 2, 3, 4, 5, 6, 7, 8};
    CStudent boy("Adam", SPI, 8);

    std::cout << "Name:" << boy.getName() << std::endl;
    std::cout << boy.getName() << "'s CPI:" << boy.getCPI() << std::endl;

    {
        CStudent boy_clone = boy;
        
        std::cout << "Name:" << boy_clone.getName() << std::endl;
        std::cout << boy_clone.getName() << "'s CPI:" << boy_clone.getCPI() << std::endl;
    }
        
    std::cout << "Changing SPI..." << std::endl;
    boy.setSPI(0, 9);

    return 0;
}
Esempio n. 3
0
	void target()
	{

	  int gdriver=DETECT,gmode;
	  int d,i;
	  int a,b;
	  char ch;
	  clrscr();
	  ;
	  initgraph(&gdriver,&gmode,"C:\\Turboc3\\BGI");
	  setlinestyle(0,10,3);


	  outtextxy(530,30,"Target 1");
	  outtextxy(500,130,"Target 2");
	  outtextxy(530,230,"Target 3");
	  outtextxy(500,340,"Target 4");
	  outtextxy(530,410,"Target 5");


	line(200,158,250,158);		//gun

	outtextxy(230,145,"Gun Point");







	circle(185,95,7);         //eyes
	circle(215,95,7);

	arc(200,100,210,330,20);	//mouth
	line(200,100,200,116);         //nose




	  circle(200,100,30);
	  line(200,130,200,230);

	  line(200,160,230,130);
	  line(200,160,170,130);

	  line(200,230,170,260);
	  line(200,230,230,260);




	  a=200,b=100;


	  rectangle(620,10,630,130);
	  rectangle(620,170,630,290);
	  rectangle(620,330,630,450);

	  rectangle(580,70,590,210);
	  rectangle(580,250,590,390);




	  while(1)
	  {
	    ch=getch();
	    d=ch;
 //	    rectangle(620,100,630,200);

	       if(d==77)
	       {
	       cleardevice();
	       a=a+20;
	       boy1(a,b);

	       delay(200);
	       cleardevice();

	       boy(a,b);
	       }

	       if(d==75)
	       {
	       cleardevice();
	       a=a-20;
	       boy1(a,b);

	       delay(200);
	       cleardevice();

	       boy(a,b);
	       }

	       if(d==72)
	       {
	       cleardevice();
	       b=b-20;
	       boy1(a,b);

	       delay(200);
	       cleardevice();

	       boy(a,b);
	       }

	       if(d==80)
	       {
	       cleardevice();
	       b=b+20;
	       boy1(a,b);

	       delay(200);
	       cleardevice();

	       boy(a,b);
	       }


//////////////////////////////////////////////////////////////////
///shooting starts
//////////////////////////////////////////////////////////////////




	       if(d==32)
	       {


						//x=200  y=100
		int x=a;
		int y=b;
//		printf("%d %d",x,y);



//////////////////////////////////////////////////////////////////////////
		if((y>-50)&&(y<5))
		{
			for( i=0;i<=27;i++)
			{
			rectangle(x,y+58,x+22,y+65 );
			x=x+15;
		    //	delay(0);
			sound(900);
			boy(a,b);
			nosound();
			}
		cleardevice();
		boy(a,b);
		sound(900);
		delay(200);
		sound(1600);
		delay(200);
		nosound();
		outtextxy(110,400,"Target 1 shooted  !!!!!");
     //		outtextxy(230,145,"Gun Point");
		boy(a,b);
		}
//////////////////////////////////////////////////////////////////////////
		if((y>5)&&(y<150))
		{
			for( i=0;i<=24;i++)
			{
			rectangle(x,y+58,x+22,y+65 );
			x=x+15;
		  //	delay(10);
			sound(900);
			boy(a,b);
			nosound();
			}
		cleardevice();
		boy(a,b);
		sound(900);
		delay(200);
		sound(1600);
		delay(200);
		nosound();
     //		outtextxy(230,145,"Gun Point");
		 outtextxy(110,400,"Target 2 shooted  !!!!!");

		boy(a,b);
		}
//////////////////////////////////////////////////////////////////////////
		if((y>150)&&(y<190))
		{
			for( i=0;i<=27;i++)
			{
			rectangle(x,y+58,x+22,y+65 );
			x=x+15;
		    //	delay(10);
			sound(900);
			boy(a,b);
			nosound();
			}

		cleardevice();
		boy(a,b);
		sound(900);
		delay(200);
		sound(1600);
		delay(200);
		nosound();
		outtextxy(110,400,"Target 3 shooted  !!!!!");
       //		outtextxy(230,145,"Gun Point");
		boy(a,b);
		}
/////////////////////////////////////////////////////////////////////////
		if((y>190)&&(y<310))
		{
		       for( i=0;i<=24;i++)
			{
			rectangle(x,y+58,x+22,y+65 );
			x=x+15;
		  //	delay(10);
			sound(900);
			boy(a,b);
			nosound();
			}
		cleardevice();
		boy(a,b);
		sound(900);
		delay(200);
		sound(1600);
		delay(200);
		nosound();
		outtextxy(110,150,"Target 4 shooted  !!!!!");
	 //	outtextxy(230,145,"Gun Point");
		boy(a,b);
		}
//////////////////////////////////////////////////////////////////////////

		if((y>310)&&(y<390))
		{
			for( i=0;i<=27;i++)
			{
			rectangle(x,y+58,x+22,y+65 );
			x=x+15;
		  //	delay(10);
			sound(900);
			boy(a,b);
			nosound();
			}
		cleardevice();
		boy(a,b);
		sound(900);
		delay(200);
		sound(1600);
		delay(200);
		nosound();
		outtextxy(110,200,"Target 5 shooted  !!!!!");
	   //	outtextxy(230,145,"Gun Point");
		boy(a,b);
		}
///////////////////////////////////////////////////



	       }







	   if(d==27)
	   break;
	  }


	}