本文整理汇总了C++中TransformComponent::move方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::move方法的具体用法?C++ TransformComponent::move怎么用?C++ TransformComponent::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void BulletScript::Update(GameEngine *game)
{
TransformComponent *transform = this->gameObject->GetComponent<TransformComponent*>();
transform->move(20, 0);
for (std::vector<GameObject*>::iterator it = this->gameObject->gameScene->gameObjects.begin(); it != this->gameObject->gameScene->gameObjects.end(); it++)
{
ColliderComponent *thisObject = this->gameObject->GetComponent<ColliderComponent*>();
if ((*it)->getName() == "enemy")
{
ColliderComponent *anotherObject = (*it)->GetComponent<ColliderComponent*>();
if (anotherObject != NULL && thisObject != anotherObject)
{
//std::cout << anotherObject->getX();
if (thisObject->getX() + thisObject->getWidth() >= anotherObject->getX() && thisObject->getX() <= anotherObject->getX() + anotherObject->getWidth()
&& thisObject->getY() + thisObject->getHeight() >= anotherObject->getY() && thisObject->getY() <= anotherObject->getY() + anotherObject->getHeight())
{
(*it)->setEnable(false);
//BulletScript::SCORE++;
//std::cout << BulletScript::SCORE++;
/*
score_ = db->load_int_data("pontos");
db->save_data("pontos", score_++, 0, 0);
TextComponent * text = this->gameObject->GetComponent<TextComponent*>();
text->set_string(std::string("score: " + score_));*/
(*score)++;
}
}
}
}
}