本文整理汇总了C++中BadGuy::get_group方法的典型用法代码示例。如果您正苦于以下问题:C++ BadGuy::get_group方法的具体用法?C++ BadGuy::get_group怎么用?C++ BadGuy::get_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BadGuy
的用法示例。
在下文中一共展示了BadGuy::get_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collision_badguy
HitResponse
BadGuy::collision(GameObject& other, const CollisionHit& hit)
{
if (!is_active()) return ABORT_MOVE;
BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
if(badguy && badguy->is_active() && badguy->get_group() == COLGROUP_MOVING) {
/* Badguys don't let badguys squish other badguys. It's bad. */
#if 0
// hit from above?
if (badguy->get_bbox().p2.y < (bbox.p1.y + 16)) {
if(collision_squished(*badguy)) {
return ABORT_MOVE;
}
}
#endif
return collision_badguy(*badguy, hit);
}
Player* player = dynamic_cast<Player*> (&other);
if(player) {
// hit from above?
if (player->get_bbox().p2.y < (bbox.p1.y + 16)) {
if(player->is_stone()) {
kill_fall();
return FORCE_MOVE;
}
if(collision_squished(*player)) {
return FORCE_MOVE;
}
}
if(player->is_stone()) {
collision_solid(hit);
return FORCE_MOVE;
}
return collision_player(*player, hit);
}
Bullet* bullet = dynamic_cast<Bullet*> (&other);
if(bullet)
return collision_bullet(*bullet, hit);
return FORCE_MOVE;
}
示例2: collision_badguy
HitResponse
BadGuy::collision(GameObject& other, const CollisionHit& hit)
{
if (!is_active()) return ABORT_MOVE;
BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
if(badguy && badguy->is_active() && badguy->get_group() == COLGROUP_MOVING) {
// hit from above?
if (badguy->get_bbox().p2.y < (bbox.p1.y + 16)) {
if(collision_squished(*badguy)) {
return ABORT_MOVE;
}
}
return collision_badguy(*badguy, hit);
}
Player* player = dynamic_cast<Player*> (&other);
if(player) {
// hit from above?
if (player->get_bbox().p2.y < (bbox.p1.y + 16)) {
if(collision_squished(*player)) {
return FORCE_MOVE;
}
}
return collision_player(*player, hit);
}
Bullet* bullet = dynamic_cast<Bullet*> (&other);
if(bullet)
return collision_bullet(*bullet, hit);
return FORCE_MOVE;
}