本文整理汇总了C++中AnimatedSprite::onGround方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::onGround方法的具体用法?C++ AnimatedSprite::onGround怎么用?C++ AnimatedSprite::onGround使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatedSprite
的用法示例。
在下文中一共展示了AnimatedSprite::onGround方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleKeyEvents
//.........这里部分代码省略.........
else if (input->isKeyDown('8'))
{
game->quitGame();
game->setCurrentLevelFileName(W_LEVEL_8_NAME);
game->startGame();
//game->getGSM()->unloadCurrentLevel();
//game->getGSM()->loadLevel(game, W_LEVEL_1_DIR + W_LEVEL_4_NAME);
}
else if (input->isKeyDown('9'))
{
game->quitGame();
game->setCurrentLevelFileName(W_LEVEL_9_NAME);
game->startGame();
//game->getGSM()->unloadCurrentLevel();
//game->getGSM()->loadLevel(game, W_LEVEL_1_DIR + W_LEVEL_4_NAME);
}
else if (input->isKeyDown('0'))
{
game->quitGame();
game->setCurrentLevelFileName(W_LEVEL_10_NAME);
game->startGame();
//game->getGSM()->unloadCurrentLevel();
//game->getGSM()->loadLevel(game, W_LEVEL_1_DIR + W_LEVEL_4_NAME);
}
else if (input->isKeyDown(A_KEY))
{
if (player->dead == false)
{
pp->facing = 1;
if ((phy->CurrentGrav == phy->Normal_Grav || phy->CurrentGrav == phy->Reverse_Grav))
{
if (player->onGround())
body->ApplyForce(b2Vec2(body->GetMass() * -0.1 / (1 / 60.0), 0), body->GetWorldCenter(), true);
else
body->ApplyForce(b2Vec2(body->GetMass() * -0.1 / (1 / 60.0), 0), body->GetWorldCenter(), true);
}
if ((phy->CurrentGrav == phy->Left_Grav || phy->CurrentGrav == phy->Right_Grav))
{
if (player->onGround())
body->ApplyForce(b2Vec2(0, body->GetMass() * -0.1 / (1 / 60.0)), body->GetWorldCenter(), true);
else
body->ApplyForce(b2Vec2(0, body->GetMass() * -0.1 / (1 / 60.0)), body->GetWorldCenter(), true);
}
if (player->onGround())
{
if (phy->CurrentGrav == phy->Normal_Grav)
player->setCurrentState(LWALK);
else if (phy->CurrentGrav == phy->Reverse_Grav)
player->setCurrentState(ULWALK);
else if (phy->CurrentGrav == phy->Right_Grav)
player->setCurrentState(RLWALK);
else if (phy->CurrentGrav == phy->Left_Grav)
player->setCurrentState(LLWALK);
}
else
{
if (phy->CurrentGrav == phy->Normal_Grav)
player->setCurrentState(LFALL);
else if (phy->CurrentGrav == phy->Reverse_Grav)
player->setCurrentState(ULFALL);
else if (phy->CurrentGrav == phy->Right_Grav)
player->setCurrentState(RLFALL);