本文整理汇总了C++中Wall::setChangesColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Wall::setChangesColor方法的具体用法?C++ Wall::setChangesColor怎么用?C++ Wall::setChangesColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wall
的用法示例。
在下文中一共展示了Wall::setChangesColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
BOOL Game::update()
{
BOOL updateObjects = FALSE;
BOOL checkForWinning = FALSE;
BOOL checkForLosing = FALSE;
BOOL checkCollisions = FALSE;
BOOL stopMovement = TRUE;
switch (itsCurrentState)
{
case GAMESTATE_PREGAME :
// since the pregame section is so different, we will call our own method
pregameUpdate();
break;
case GAMESTATE_INPROGRESS :
updateObjects = TRUE;
checkForWinning = TRUE;
checkForLosing = TRUE;
checkCollisions = TRUE;
stopMovement = FALSE;
break;
case GAMESTATE_WON :
{
updateObjects = TRUE;
Room *room = itsPlayer->getRoom();
// we need to change the walls a color for that ending flashiness
if (itsLastTickTime - itsWinTime >= theWinAnimationLength)
{
for (UINT i=0;i<room->getWalls()->length();i++)
{
Wall *wall = (Wall *)(room->getWalls()->elementAt(i));
wall->setChangesColor(FALSE);
}
}
else
{
// since the player will be holding the chalice, we can tell
// the walls to change colors, and they will change to the color
// of the chalice, which will make them appear to animate
for (UINT i=0;i<room->getWalls()->length();i++)
{
Wall *wall = (Wall *)(room->getWalls()->elementAt(i));
wall->setChangesColor(TRUE,1);
}
}
// hack to put the player in the right place for the ending
itsPlayer->setX(Game::theScreenHeight-64);
itsPlayer->setY(Game::theScreenWidth/2-16);
}
break;
case GAMESTATE_LOST :
updateObjects = TRUE;
stopMovement = FALSE;
break;
case GAMESTATE_PAUSED :
stopMovement = FALSE;
break;
}
theEventDispatcher.update(itsLastTickTime);
if (updateObjects)
{
SimpleArray *objects = NULL;
if (itsWorld != NULL)
objects = itsWorld->getObjects();
for (UINT i=0;i<objects->length();i++)
{
((GameObject *)(objects->elementAt(i)))->update(itsLastTickTime);
if (stopMovement)
{
((GameObject *)(objects->elementAt(i)))->stopMoving(itsLastTickTime);
}
}
for (i=0;i<itsWorld->getRooms()->length();i++)
{
((Room *)(itsWorld->getRooms()->elementAt(i)))->checkForObjectsLeaving();
}
}
if (checkForWinning && gameWon())
{
itsNewStateRequest.itsNewState = GAMESTATE_WON;
itsNewStateRequest.isActiveRequest = TRUE;
}
if (checkForLosing && gameLost())
{
itsNewStateRequest.itsNewState = GAMESTATE_LOST;
itsNewStateRequest.isActiveRequest = TRUE;
}
if (checkCollisions)
return checkForCollisions();
else
return TRUE;
}