Home > Back-end >  To help eldest brother see why game_music and explodes the two delayed broadcast of the concert
To help eldest brother see why game_music and explodes the two delayed broadcast of the concert

Time:10-01

To help eldest brother see why game_music and explodes the two concerts delay play
#include
#include
#include
#include
# pragma comment (lib, "Winmm. Lib")
# define H 800
# define W 590

IMAGE img_bk;
IMAGE img_planeNormal_1 img_planeNormal_2;
IMAGE img_bullet1 img_bullet2;
IMAGE img_enemyPlane1 img_enemyPlane2;
IMAGE img_planeExplode_1 img_planeExplode_2;
Float position_x position_y;
Float bullet_x bullet_y;
Float enemy_x enemy_y;
Int isExplode=0;
int score=0;
Void startup ()
{
McISendString (_T (" open \ \ game_music mp3 alias bkmusic "), NULL, 0, NULL);
McISendString (_T (" play bkmusic repeat "), NULL, 0, NULL);
Initgraph (W, H);
Loadimage (& amp; Img_bk, _T (". \ \ background. JPG "));
Loadimage (& amp; Img_planeNormal_1, _T (". \ \ planeNormal_1 JPG "));
Loadimage (& amp; Img_planeNormal_2, _T (". \ \ planeNormal_2 JPG "));
Loadimage (& amp; Img_bullet1, _T (". \ \ bullet1 JPG "));
Loadimage (& amp; Img_bullet2, _T (". \ \ bullet2 JPG "));
Loadimage (& amp; Img_enemyPlane1, _T (". \ \ enemyPlane1 JPG "));
Loadimage (& amp; Img_enemyPlane2, _T (". \ \ enemyPlane2 JPG "));
Loadimage (& amp; Img_planeExplode_1, _T (". \ \ planeExplode_1 JPG "));
Loadimage (& amp; Img_planeExplode_2, _T (". \ \ planeExplode_2 JPG "));
Position_x=W * 0.5;
Position_y=H * 0.7;
Bullet_x=position_x;
Bullet_y=85;
Enemy_x=W * 0.5;
Enemy_y=10;

BeginBatchDraw ();
}
Void the show ()
{
Putimage (0, 0, & amp; Img_bk);
If (isExplode==0)
{
Putimage (position_y, position_x - 50-60, & amp; Img_planeNormal_1 NOTSRCERASE);
Putimage (position_y, position_x - 50-60, & amp; Img_planeNormal_2 SRCINVERT);
Putimage (bullet_x - 7, bullet_y, & amp; Img_bullet1 NOTSRCERASE);
Putimage (bullet_x - 7, bullet_y, & amp; Img_bullet2 SRCINVERT);
Putimage (enemy_x enemy_y, & amp; Img_enemyPlane1 NOTSRCERASE);
Putimage (enemy_x enemy_y, & amp; Img_enemyPlane2 SRCINVERT);
}
The else
{
Putimage (position_y, position_x - 50-60, & amp; Img_planeExplode_1 NOTSRCERASE);
Putimage (position_y, position_x - 50-60, & amp; Img_planeExplode_2 SRCINVERT);
}

FlushBatchDraw ();
Sleep (2);
}
Void updatewithoutinput ()
{
If (bullet_y & gt; - 25)
Bullet_y -=2;
If (enemy_y & lt; H - 25)
Enemy_y +=0.5;
The else
Enemy_y=10;
If (abs ((int) (bullet_x - enemy_x)) + abs ((int) (bullet_y - enemy_y)) & lt; 50)
{
Enemy_x=rand () % W;
Enemy_y=- 40;
Bullet_y=85;
McISendString (_T (" close gemusic "), NULL, 0, NULL);
McISendString (_T (" open \ \ gotEnemy mp3 alias gemusic "), NULL, 0, NULL);
McISendString (_T (" play gemusic "), NULL, 0, NULL);
Score++;

If ((score & gt; 0) & amp; & (score % 5==0) & amp; & Score (% 2!=0))
{
McISendString (_T (5 music "close"), NULL, 0, NULL);
McISendString (_T (" open. \ \ 5. 5 music mp3 alias "), NULL, 0, NULL);
McISendString (_T (" play 5 music "), NULL, 0, NULL);
}

If (% score 10==0)
{
McISendString (_T (close to 10 "music"), NULL, 0, NULL);
McISendString (_T (open. \ \ "10. 10 music mp3 alias"), NULL, 0, NULL);
McISendString (_T (" play 10 music "), NULL, 0, NULL);
}
}
If (abs ((int) (position_x - enemy_x)) + abs ((int) (position_y - enemy_y)) & lt; 150)
{
IsExplode=1;
McISendString (_T (" close exmusic "), NULL, 0, NULL);
McISendString (_T (open. \ \ "explodes. The mp3 alias exmusic"), NULL, 0, NULL);
McISendString (_T (" play exmusic "), NULL, 0, NULL);
}


}
Void updatewithinput ()
{

MOUSEMSG m;
While (MouseHit ())
{
M=GetMouseMsg ();
If (m.u Msg==WM_MOUSEMOVE)
{
Position_x=m.x;
Position_y=m.y;
}
Else if (m.u Msg==WM_LBUTTONDOWN)
{
Bullet_x=position_x;
Bullet_y=position_y - 85;
McISendString (_T (" close fgmusic "), NULL, 0, NULL);
McISendString (_T (" open \ \ f_gun mp3 alias fgmusic "), NULL, 0, NULL);
McISendString (_T (" play fgmusic "), NULL, 0, NULL);
}
}

}

Void gameover ()
{
EndBatchDraw ();
_getch ();
Closegraph ();
}
Int main ()
{
Startup ();
While (1)
{
Show ();
Updatewithoutinput ();
Updatewithinput ();
}
Gameover ();
return 0;
}
  • Related