📄 mygame.cpp
字号:
bul.status=BULLET_NORMAL;
tempp.zd.push_back(bul);
tempp.zd.push_back(bul1);
tempp.zd.push_back(bul2);
}
}
if (tempp.enemytype==7)
{
tempp.bulidx++;
if (tempp.bulidx==tempp.bullettim)
{
tempp.bulidx=0;
bullet bul(48,6,25,tempp.PPos.x,tempp.PPos.y+22,9,0,1,20);
bul.status=BULLET_NORMAL;
tempp.zd.push_back(bul);
}
}
}
(*itpen)=tempp;
}
for (itpen=planeenemy.begin();itpen!=planeenemy.end();itpen++)
{
Cpenemy tempp;
tempp=*itpen;
RECT r1,r2;
r1.left =player1.PPos.x;
r1.right=r1.left+player1.width;
r1.top=player1.PPos.y+10;
r1.bottom=r1.top+18;
for (itbul=tempp.zd.begin ();itbul!=tempp.zd .end ();itbul++)
{
bullet temp;
temp=*itbul;
if (temp.status!=BULLET_UNABLE)
{
r2.left=temp.Pos.x;
r2.right=r2.left+temp.width;
r2.top=temp.Pos.y;
r2.bottom=r2.top+temp.height;
if (msIsIntersectRect( &r1,&r2 ))
{
mhit->Play();
player1.health-=temp.power;
if (player1.health<=0)
{
mboom1->Play();
xg xgtemp(54,50,player1.PPos.x,player1.PPos.y,10,10,3);
vxg.push_back(xgtemp);
player1.PPos.x =100;
player1.PPos.y=221;
player1.pmovidx=8;
player1.health=500;
player1.movestate =0;
player1.playerstate =0;
player1.bulltp=2;
player1.bullpw=3;
player1.boom=9;
rl.xgPos.x =66;
rl.xgPos .y =226;
player1.zd.clear ();
}
temp.status=BULLET_UNABLE;
xg xgtemp(48,48,player1.PPos.x,player1.PPos.y,6,6,9);
vxg.push_back(xgtemp);
}
}
(*itbul)=temp;
}
(*itpen)=tempp;
}
for (itpen=planeenemy.begin();itpen!=planeenemy.end();itpen++)
{
Cpenemy tempp;
tempp=*itpen;
{
if(tempp.enemystate!=ENEMY_STATUS_DEAD)
{
if (tempp.animidx==tempp.maxfrm)tempp.animidx =0;
if (tempp.enemytype==7)tempp.animidx=9;
RECT rep;
rep.left=tempp.width*(tempp.animidx % tempp.row);
rep.top=tempp.height*(tempp.animidx / tempp.row);
rep.right=rep.left+tempp.width;
rep.bottom=rep.top+tempp.height;
tempp.animidx++;
GetGraphics()->DrawBitmapMMX( tempp.PPos.x,tempp.PPos.y ,enemy[tempp.enemytype ] , SCREENBUFFER,&rep,true );
}
for (itbul=tempp.zd.begin ();itbul!=tempp.zd .end ();itbul++)
{
bullet temp;
temp=*itbul;
if ((temp.Pos.x<=0)||(temp.Pos.y<=0)||(temp.Pos.y>=480)||(temp.Pos.x>640))
{
temp.status=BULLET_UNABLE;
}
if (temp.type==3)
{
temp.Pos.x+=temp.dx;
temp.Pos.y+=temp.dy;
if (temp.animidx==temp.maxframe)temp.animidx =0;
temp.drect .left =temp.animidx*temp.width;
temp.drect .right =temp.drect.left+temp.width;
temp.drect .top =0;
temp.drect .bottom =temp.height;
temp.animidx++;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );}
}
if (temp.type==4)
{
static int idx=0;
if (idx==3) idx=0;
if (idx==0){temp.dx=-10;temp.dy=-6;}
if (idx==1){temp.dx=-12;temp.dy=0;}
if (idx==2){temp.dx=-10;temp.dy=6;}
temp.Pos.x+=temp.dx;
temp.Pos.y+=temp.dy;
if (temp.animidx==temp.maxframe)temp.animidx =0;
temp.drect .left =temp.animidx*temp.width;
temp.drect .right =temp.drect.left+temp.width;
temp.drect .top =0;
temp.drect .bottom =temp.height;
temp.animidx++;
idx++;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );}
}
if (temp.type==5)
{
temp.Pos.x+=temp.dx;
temp.Pos.y+=temp.dy;
if (temp.animidx==temp.maxframe)temp.animidx =0;
temp.drect .left =temp.animidx*temp.width;
temp.drect .right =temp.drect.left+temp.width;
temp.drect .top =0;
temp.drect .bottom =temp.height;
temp.animidx++;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );}
}
if (temp.type==6)
{
static int idx=0;
if (idx==3) idx=0;
if (idx==0){temp.dx=-15;temp.dy=-1;}
if (idx==1){temp.dx=-18;temp.dy=0;}
if (idx==2){temp.dx=-15;temp.dy=1;}
temp.Pos.x+=temp.dx;
temp.Pos.y+=temp.dy;
if (temp.animidx==temp.maxframe)temp.animidx =0;
temp.drect .left =temp.animidx*temp.width;
temp.drect .right =temp.drect.left+temp.width;
temp.drect .top =0;
temp.drect .bottom =temp.height;
temp.animidx++;
idx++;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );}
}
if (temp.type==7)
{
static int idx=0;
if (idx==4) idx=0;
if (idx==0){temp.dx=-4;temp.dy=-4;temp.drect.left=16;}
if (idx==1){temp.dx=-4;temp.dy=4;temp.drect.left=48;}
if (idx==2){temp.dx=4;temp.dy=4;temp.drect.left=16;}
if (idx==3){temp.dx=4;temp.dy=-4;temp.drect.left=48;}
temp.Pos.x+=temp.dx;
temp.Pos.y+=temp.dy;
temp.drect.right=temp.drect.left+temp.width;
temp.drect.top=0;
temp.drect.bottom=temp.height;
idx++;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );}
}
if (temp.type==8)
{
static int idx=0;
if (idx==3) idx=0;
if (idx==0){temp.dx=-15;temp.dy=0;}
if (idx==1){temp.dx=-15;temp.dy=0;}
if (idx==2){temp.dx=-15;temp.dy=0;}
temp.Pos.x+=temp.dx;
temp.Pos.y+=temp.dy;
if (temp.animidx==temp.maxframe)temp.animidx =0;
temp.drect .left =temp.animidx*temp.width;
temp.drect .right =temp.drect.left+temp.width;
temp.drect .top =0;
temp.drect .bottom =temp.height;
temp.animidx++;
idx++;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );}
}
if (temp.type==9)
{
temp.Pos.x-=20;
if (temp.status==BULLET_NORMAL)
{GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER,true );}
}
(*itbul)=temp;
}
}
(*itpen)=tempp;
}
for (itbul=player1.zd.begin();itbul!=player1.zd.end();itbul++)
{
bullet temp;
temp=*itbul;
if (temp.status!=BULLET_UNABLE)
{
RECT r1,r2;
r1.left =temp.Pos.x;
r1.right=r1.left+temp.width;
r1.top=temp.Pos.y;
r1.bottom=r1.top+temp.height;
for(itpen=planeenemy.begin();itpen!=planeenemy.end();itpen++)
{
Cpenemy tempp;
tempp=*itpen;
if (tempp.enemystate!=ENEMY_STATUS_DEAD)
{
r2.left =tempp.PPos.x;
r2.right=r2.left+tempp.width;
r2.top=tempp.PPos.y;
r2.bottom=r2.top+tempp.height;
if (msIsIntersectRect( &r1,&r2 ))
{
if (temp.type==1)
{
xg xgtemp(48,32,tempp.PPos.x,temp.Pos.y,11,11,6);
vxg.push_back(xgtemp);
}
if (temp.type==2)
{
xg xgtemp(43,43,tempp.PPos.x,temp.Pos.y,9,3,7);
vxg.push_back(xgtemp);
}
if (temp.type==0)
{
xg xgtemp(8,8,tempp.PPos.x-10,temp.Pos.y-8,6,6,8);
vxg.push_back(xgtemp);
xg xgtemp1(8,8,tempp.PPos.x+5,temp.Pos.y,6,6,8);
vxg.push_back(xgtemp1);
xg xgtemp2(8,8,tempp.PPos.x,temp.Pos.y+8,6,6,8);
vxg.push_back(xgtemp2);
}
tempp.health-=(temp.power*5);
if (tempp.health<=0)
{
tempp.enemystate=ENEMY_STATUS_DEAD;
if (tempp.enemytype==1)
{
mboom1->Play();
bouns bounstemp(tempp.PPos.x,tempp.PPos.y,15,13,2,2,2);
vbouns.push_back(bounstemp);
xg xgtemp(100,90,tempp.PPos.x,tempp.PPos.y,11,6,0);
vxg.push_back(xgtemp);
}
if (tempp.enemytype==0)
{
xg xgtemp(40,42,tempp.PPos.x,tempp.PPos.y,16,16,4);
vxg.push_back(xgtemp);
mboom2->Play();
}
if (tempp.enemytype==3)
{
xg xgtemp(100,90,tempp.PPos.x,tempp.PPos.y,11,6,0);
vxg.push_back(xgtemp);
mboom3->Play();
}
if (tempp.enemytype==4)
{
xg xgtemp(48,32,tempp.PPos.x+35,tempp.PPos.y,16,8,6);
vxg.push_back(xgtemp);
mboom4->Play();
}
if (tempp.enemytype==5)
{
xg xgtemp(48,32,tempp.PPos.x,tempp.PPos.y,16,8,6);
vxg.push_back(xgtemp);
mboom1->Play();
}
if (tempp.enemytype==6)
{
xg xgtemp(100,90,tempp.PPos.x,tempp.PPos.y,11,6,0);
vxg.push_back(xgtemp);
bouns bounstemp(tempp.PPos.x,tempp.PPos.y,15,13,1,2,2);
vbouns.push_back(bounstemp);
mboom2->Play();
}
if (tempp.enemytype==7)
{
xg xgtemp(54,50,tempp.PPos.x,tempp.PPos.y,10,10,3);
vxg.push_back(xgtemp);
mboom3->Play();
}
if (tempp.enemytype==8)
{
xg xgtemp(65,75,tempp.PPos.x,tempp.PPos.y,12,6,2);
vxg.push_back(xgtemp);
mboom4->Play();
}
if (tempp.enemytype==9)
{
xg xgtemp(65,75,tempp.PPos.x,tempp.PPos.y,12,6,2);
vxg.push_back(xgtemp);
mboom1->Play();
}
if (tempp.enemytype==10)
{
xg xgtemp(65,75,tempp.PPos.x,tempp.PPos.y,12,6,2);
vxg.push_back(xgtemp);
put=1;
puta=tempp.PPos.x;
putb=tempp.PPos.y;
mboom2->Play();
}
if (tempp.enemytype==2)
{
xg xgtemp(54,50,tempp.PPos.x,tempp.PPos.y,10,10,3);
vxg.push_back(xgtemp);
bouns bounstemp(tempp.PPos.x,tempp.PPos.y,15,13,0,2,2);
vbouns.push_back(bounstemp);
bullet bul(tempp.PPos.x-16,tempp.PPos.y+17,0,-3);
bullet bul1(tempp.PPos.x-16,tempp.PPos.y+17,-2,-2);
bullet bul2(tempp.PPos.x-16,tempp.PPos.y+17,-3,0);
bullet bul3(tempp.PPos.x-16,tempp.PPos.y+17,-2,2);
bullet bul4(tempp.PPos.x-16,tempp.PPos.y+17,0,3);
bullet bul5(tempp.PPos.x-16,tempp.PPos.y+17,2,2);
bullet bul6(tempp.PPos.x-16,tempp.PPos.y+17,3,0);
bullet bul7(tempp.PPos.x-16,tempp.PPos.y+17,2,-2);
pub.push_back(bul);
pub.push_back(bul1);
pub.push_back(bul2);
pub.push_back(bul3);
pub.push_back(bul4);
pub.push_back(bul5);
pub.push_back(bul6);
pub.push_back(bul7);
mboom3->Play();
}
}
temp.status=BULLET_UNABLE;
}
}
(*itpen)=tempp;
}
}
(*itbul)=temp;
}
for(itbul=pub.begin();itbul!=pub.end();itbul++)
{
bullet temp;
temp=*itbul;
if ((temp.Pos.x<=0)||(temp.Pos.y<=0)||(temp.Pos.y>=480)||(temp.Pos.x>640))
{
temp.status=BULLET_UNABLE;
}
temp.Pos.x-=temp.dx;
temp.Pos.y-=temp.dy;
if (temp.animidx==temp.maxframe)temp.animidx =0;
temp.drect .left =temp.animidx*temp.width;
temp.drect .right =temp.drect.left+temp.width;
temp.drect .top =0;
temp.drect .bottom =temp.height;
temp.animidx++;
if (temp.status==BULLET_NORMAL)
{
GetGraphics()->DrawBitmapMMX( temp.Pos.x,temp.Pos.y ,bull[temp.type ] , SCREENBUFFER, &temp.drect,true );
}
(*itbul)=temp;
}
for(itxg=vxg.begin();itxg!=vxg.end();itxg++)
{
xg xgtemp;
xgtemp=*itxg;
if (xgtemp.status==XG_STATUS_NORMAL)
{
if (xgtemp.index==xgtemp.maxframe) xgtemp.status=XG_STATUS_DEAD;
RECT rxg;
rxg.left=xgtemp.width*(xgtemp.index % xgtemp.row);
rxg.top=xgtemp.height*(xgtemp.index / xgtemp.row);
rxg.right=rxg.left+xgtemp.width;
rxg.bottom=rxg.top+xgtemp.height;
GetGraphics()->DrawBitmapMMX( xgtemp.xgPos.x,xgtemp.xgPos.y ,boom[xgtemp.type] , SCREENBUFFER, &rxg,true );
xgtemp.index++;
}
(*itxg)=xgtemp;
}
for (itbouns=vbouns.begin();itbouns!=vbouns.end();itbouns++)
{
bouns bounstmp;
bounstmp=*itbouns;
if (bounstmp.status==BOUNS_STATUS_NORMAL)
{
if (bounstmp.animidx==bounstmp.maxframe) bounstmp.animidx=0;
RECT rxg;
rxg.left=bounstmp.width*(bounstmp.animidx % bounstmp.row);
rxg.top=bounstmp.height*(bounstmp.animidx / bounstmp.row);
rxg.right=rxg.left+bounstmp.width;
rxg.bottom=rxg.top+bounstmp.height;
/* bounstmp.dx=retran(6)-2;
bounstmp.dy=retran(2)-1;
bounstmp.Pos.x+=bounstmp.dx;
bounstmp.Pos.y+=bounstmp.dy;*/
GetGraphics()->DrawBitmapMMX( bounstmp.Pos.x,bounstmp.Pos.y ,pbouns[bounstmp.type] , SCREENBUFFER, &rxg,true );
bounstmp.animidx++;
}
(*itbouns)=bounstmp;
}
for(itbul=pub.begin();itbul!=pub.end();itbul++)
{
RECT r1,r2;
r1.left =player1.PPos.x;
r1.right=r1.left+player1.width;
r1.top=player1.PPos.y+10;
r1.bottom=r1.top+18;
bullet temp;
temp=*itbul;
if (temp.status!=BULLET_UNABLE)
{
r2.left=temp.Pos.x;
r2.right=r2.left+temp.width;
r2.top=temp.Pos.y;
r2.bottom=r2.top+temp.height;
if (msIsIntersectRect( &r1,&r2 ))
{
mhit->Play();
player1.health-=temp.power;
if (player1.health<=0)
{
mboom1->Play();
xg xgtemp(54,50,player1.PPos.x,player1.PPos.y,10,10,3);
vxg.push_back(xgtemp);
player1.PPos.x =100;
player1.PPos.y=221;
player1.pmovidx=8;
player1.health=500;
player1.movestate =0;
player1.playerstate =0;
player1.bulltp=2;
player1.bullpw=3;
player1.boom=9;
rl.xgPos.x =66;
rl.xgPos .y =226;
player1.zd.clear ();
}
temp.status=BULLET_UNABLE;
xg xgtemp(48,48,player1.PPos.x,player1.PPos.y,6,6,9);
vxg.push_back(xgtemp);
}
}
(*itbul)=temp;
}
{
RECT r1,r2;
r1.left =player1.PPos.x;
r1.right=r1.left+player1.width;
r1.top=player1.PPos.y+10;
r1.bottom=r1.top+18;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -