level 2
xiaoblack22
楼主
//战机导弹炸掉BOSS
POSITION gPos1=NULL,gPos2=NULL;
if(m_pMe->level==9)
{CRect BRect = e->GetRect();//
就是这里产生断点,e是我定义的CBoss*e;CBoss是我自己定义的BOSS类;另外我在用这些指针时候特别容易产生断点运行着运行着就崩!编译没错误玩着玩着到执行到这里就崩!!![[怒]](/static/emoticons/u6012.png)
for(gPos1=m_ObjList[enBomb].GetHeadPosition();( gPos2 = gPos1 ) != NULL;)
{
CBomb* pBomb = (CBomb*)m_ObjList[enBomb].GetNext(gPos1);
CRect bRect = pBomb->GetRect();
CRect tmpRect;
//添加爆炸效果
if(tmpRect.IntersectRect(&bRect,BRect))
{
m_ObjList[enExplosion].AddTail(
new CExplosion(BRect.left,BRect.top)
);
//m_pMe->life--;
//删除子弹
m_ObjList[enBomb].RemoveAt(gPos2);
delete pBomb;
e->HP -= 10;
if(e->HP <= 0)
{
e->life--;
e->HP = 100;
}
if(e->life <= 0)
{
//删除战机
delete e;
e=NULL;
break;
}
}
}
}
2015年07月19日 05点07分
1
POSITION gPos1=NULL,gPos2=NULL;
if(m_pMe->level==9)
{CRect BRect = e->GetRect();//
for(gPos1=m_ObjList[enBomb].GetHeadPosition();( gPos2 = gPos1 ) != NULL;)
{
CBomb* pBomb = (CBomb*)m_ObjList[enBomb].GetNext(gPos1);
CRect bRect = pBomb->GetRect();
CRect tmpRect;
//添加爆炸效果
if(tmpRect.IntersectRect(&bRect,BRect))
{
m_ObjList[enExplosion].AddTail(
new CExplosion(BRect.left,BRect.top)
);
//m_pMe->life--;
//删除子弹
m_ObjList[enBomb].RemoveAt(gPos2);
delete pBomb;
e->HP -= 10;
if(e->HP <= 0)
{
e->life--;
e->HP = 100;
}
if(e->life <= 0)
{
//删除战机
delete e;
e=NULL;
break;
}
}
}
}