- Game Programming using Qt 5 Beginner's Guide
- Pavel Strakhov Witold Wysota Lorenz Haas
- 31字
- 2021-08-27 18:31:14
Time for action - Making the coins explode
The implementation of checkColliding() looks like this:
void MyScene::checkColliding()
{
for(QGraphicsItem* item: collidingItems(m_player)) {
if (Coin *c = qgraphicsitem_cast<Coin*>(item)) {
c->explode();
}
}
}