本文整理汇总了C++中Enemy::bottom方法的典型用法代码示例。如果您正苦于以下问题:C++ Enemy::bottom方法的具体用法?C++ Enemy::bottom怎么用?C++ Enemy::bottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy::bottom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void BloodSquirt::update()
{
if(timer.GetElapsedTime() > 0.5f)
{
for (auto it = parent->gameObjects.begin(); it!=parent->gameObjects.end(); it++)
{
if (*it == this)
{
parent->gameObjects.erase(it);
break;
}
}
delete this;
return;
}
for (auto it = parent->gameObjects.begin(); it!=parent->gameObjects.end(); it++)
{
Enemy* obj = dynamic_cast<Enemy*>(*it);
if (!obj) continue;
if (position.x + 5 < obj->left()) continue;
if (position.x - 5 > obj->right()) continue;
if (position.y + 5 < obj->top()) continue;
if (position.y - 5 > obj->bottom()) continue;
for (auto it = parent->gameObjects.begin(); it!=parent->gameObjects.end(); it++)
{
if (*it == obj)
{
parent->gameObjects.erase(it);
break;
}
}
for (auto it = parent->gameObjects.begin(); it!=parent->gameObjects.end(); it++)
{
if (*it == this)
{
parent->gameObjects.erase(it);
break;
}
}
parent->gameObjects.push_back(new DeathAnimation(parent, obj->position));
/*for (int i = 0; i < 14; i++)
{
parent->gameObjects.push_back(new BloodFart(parent, NULL, position, 1, i*24, 2.0f));
parent->gameObjects.push_back(new BloodContact(parent, NULL, Vector2f(obj->position.x+rand()%50-rand()%50, obj->bottom()), rand()%5));
}*/
delete obj;
delete this;
return;
}
imageAnimationPos += imageAnimationSpeed * DELTA_TIME;
if (imageAnimationPos > imageAnimationSwitch)
{
imageAnimationPos = 0;
if (imageIndex++ >= imageCount-1) imageIndex = 0;
}
position.x += velocity.x * DELTA_TIME;
}