本文整理汇总了C++中Helicopter::done方法的典型用法代码示例。如果您正苦于以下问题:C++ Helicopter::done方法的具体用法?C++ Helicopter::done怎么用?C++ Helicopter::done使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helicopter
的用法示例。
在下文中一共展示了Helicopter::done方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkCollision
void Bullet::checkCollision()
{
QList<QGraphicsItem *> l=scene()->items();
foreach(QGraphicsItem *item, l) {
if ( (item->type()==man_type) && item->collidesWithItem(this, Qt::IntersectsItemBoundingRect) ) {
Man* deadman = (Man*)item;
if (deadman->frame() != 5) return;
deadman->done();
emit score(10);
setShotCount(shotcount+1);
nobullets--;
deleteLater();
return;
}
else if ( (item->type()==helicopter_type) && item->collidesWithItem(this, Qt::IntersectsItemBoundingRect) ) {
Helicopter* deadchopper = (Helicopter*) item;
deadchopper->done();
emit score(50);
setShotCount(shotcount+1);
nobullets--;
deleteLater();
return;
}
}
//check shot is not out of bounds
if ( (y() < 0) || (x() < 0) ||
(y() > scene()->height()) ||
( x() > scene()->width())) {
nobullets--;
deleteLater();
return;
}
}
示例2: checkCollision
void Bullet::checkCollision()
{
QCanvasItem* item;
QCanvasItemList l=collisions(FALSE);
for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
item = *it;
if ( (item->rtti()== 1500) && (item->collidesWith(this)) ) {
Man* deadman = (Man*)item;
if (deadman->frame() != 5) return;
deadman->done();
emit score(10);
setShotCount(shotcount+1);
setAnimated(false);
nobullets--;
delete this;
return;
}
else if ( (item->rtti()==1900) && (item->collidesWith(this)) ) {
Helicopter* deadchopper = (Helicopter*) item;
deadchopper->done();
emit score(50);
setAnimated(false);
nobullets--;
delete this;
return;
}
}
//check shot is not out of bounds
if ( (y() < 0) || (x() < 0) ||
(y() > canvas()->height()) ||
( x() > canvas()->width())) {
setAnimated(false);
nobullets--;
delete this;
return;
}
}