当前位置: 首页>>代码示例>>C++>>正文


C++ CCArmature::getPosition方法代码示例

本文整理汇总了C++中CCArmature::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CCArmature::getPosition方法的具体用法?C++ CCArmature::getPosition怎么用?C++ CCArmature::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCArmature的用法示例。


在下文中一共展示了CCArmature::getPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

void GameScene::update(float dt)
{
	CCArmature * imManArmature = playLayer->imManArmature;
	int actionNum = playLayer->actionNum;
	if(actionNum ==playLayer->ACTION_RUN)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2+46,imManArmature->getPosition().y,imManArmature->getContentSize().width-90,imManArmature->getContentSize().height-50);
	}
	else if(actionNum == playLayer->ACTION_STAND_JUMP)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2+30,imManArmature->getPosition().y,imManArmature->getContentSize().width-50,imManArmature->getContentSize().height-50);
	}
	else if(actionNum == playLayer->ACTION_RUN_JUMP)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2+33,imManArmature->getPosition().y,imManArmature->getContentSize().width-70,imManArmature->getContentSize().height-50);
	}
	else if(actionNum == playLayer->ACTION_RUN_STOP)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2+40,imManArmature->getPosition().y,imManArmature->getContentSize().width-110,imManArmature->getContentSize().height-45);
	}
	else if(actionNum == playLayer->ACTION_RUN_ATTACK)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2,imManArmature->getPosition().y,imManArmature->getContentSize().width,imManArmature->getContentSize().height);

	}
	else if(actionNum == playLayer->ACTION_STAND_ATTACK)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2,imManArmature->getPosition().y,imManArmature->getContentSize().width,imManArmature->getContentSize().height);

	}
	else if(actionNum == playLayer->ACTION_DEATH)
	{
		playLayer->playerBoundingBox = CCRectMake(imManArmature->getPosition().x-imManArmature->getContentSize().width/2,imManArmature->getPosition().y,imManArmature->getContentSize().width,imManArmature->getContentSize().height);
	}

	if(gameSceneMonster->MonsterIndex == MonsterGround_enum)
	{
		gameSceneMonster->MonsterAmatureBoundingBox = CCRectMake(gameSceneMonster->MonsterAmature->getPosition().x-gameSceneMonster->MonsterAmature->getContentSize().width/2+45,gameSceneMonster->MonsterAmature->getPosition().y+21,gameSceneMonster->MonsterAmature->getContentSize().width-90,gameSceneMonster->MonsterAmature->getContentSize().height-90);
	}
	else if(gameSceneMonster->MonsterIndex == MonsterSky_enum)
	{
		gameSceneMonster->MonsterAmatureBoundingBox = CCRectMake(gameSceneMonster->MonsterAmature->getPosition().x-gameSceneMonster->MonsterAmature->getContentSize().width/2+45,gameSceneMonster->MonsterAmature->getPosition().y+21,gameSceneMonster->MonsterAmature->getContentSize().width-90,gameSceneMonster->MonsterAmature->getContentSize().height-90);
	}

	if (playLayer->playerBoundingBox.intersectsRect(gameSceneMonster->MonsterAmatureBoundingBox))
	{
		/*
		if(MonsterGround_enum == gameSceneMonster->MonsterIndex)
		{
			gameSceneMonster->unscheduleUpdate();
			gameSceneMonster->MonsterDestroyAction();
		}
		*/
		CCShake * shark = CCShake::create(0.3f,10); 
		playLayer->runAction(shark);
		playLayer->imManArmatureBrood-=1;
		if(playLayer->imManArmatureBrood<1)
		{
			GameScene::shareGameScene()->menuLayer->setBroodBarPercent(0);
			this->unscheduleUpdate();
			playLayer->IMDeath();
			return;
		}

		GameScene::shareGameScene()->menuLayer->setBroodBarPercent(playLayer->imManArmatureBrood);
	}
}
开发者ID:JinChow,项目名称:CocostudioIronCity,代码行数:67,代码来源:GameScene.cpp


注:本文中的CCArmature::getPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。