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


C++ CBlock::GetBlockId方法代码示例

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


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

示例1: Update


//.........这里部分代码省略.........
			bCheckRightHit = true;

			pAnton->SetAction(CAnton::ACTION_PUSH);

			PlaySeBoxSlip();
		}

		else if (blockPos.y - blockSize.y < antonPos.y + antonSize.y && blockPos.y + blockSize.y > antonPos.y - antonSize.y
			 && blockPos.x - blockSize.x < antonPos.x + ( antonSize.x * 1.65f ) && blockPos.x + blockSize.x > antonPos.x
			 && (blockPos.x + blockSize.x) - (antonPos.x) > -BLOCK_WIDTH
			 && (blockPos.x - blockSize.x) - (antonPos.x + antonSize.x) <= -WOODBOX_MOVE
			 && pAnton->GetState() == CAnton::STATE_POWERFUL)
		{
			blockPos.x -= WOODBOX_MOVE;

			bCheckLeftHit = true;

			pAnton->SetAction(CAnton::ACTION_PUSH);

			PlaySeBoxSlip();
		}

		// 落下の判定は、変化前の座標からブロックIDを求めて
		// 1つ下のブロックのアドレスを求める。nullだった場合は、落下。
		// nullでなくても地面と接していなかった場合も落下する。
		CBlockManager::CalculateBlockArrayNum(D3DXVECTOR3(m_pos.x + BLOCK_WIDTH / 2.0f, m_pos.y + BLOCK_HEIGHT / 2.0f, 0), &nArrayNumX, &nArrayNumY);

		pBlock = CBlockManager::GetBlock(nArrayNumX, nArrayNumY + 1);

		if (pBlock == nullptr)
		{
			blockPos.y += WOODBOX_MOVE;
		}
		else if (pBlock->GetBlockId() >= CBlock::BLOCKID_FOOD_ACORN && pBlock->GetBlockId() <= CBlock::BLOCKID_FOOD_MUSHROOM)
		{
			blockPos.y += WOODBOX_MOVE;
		}
		else
		{
			underBlockPos = pBlock -> GetPosition() + blockSize;

			if ( ( underBlockPos.y - blockSize.y ) - ( blockPos.y + blockSize.y ) >= WOODBOX_MOVE )
			{
				blockPos.y += WOODBOX_MOVE;
			}
			else if ( underBlockPos.x - blockSize.x < blockPos.x + blockSize.x && underBlockPos.x + blockSize.x > blockPos.x - blockSize.x
			   && ( ( underBlockPos.y - blockSize.y ) - ( blockPos.y + blockSize.y ) ) < 0.0f )
			{
				blockPos.y = underBlockPos.y - blockSize.y - BLOCK_HEIGHT;
			}
		}

		if ( bCheckRightHit == true )
		{
			// もし、右に木箱があったらそれもずらしておく
			pBlock = CBlockManager::GetBlock(nArrayNumX + 1, nArrayNumY);

			if (pBlock != nullptr && pBlock->GetBlockId() == CBlock::BLOCKID_WOODBOX)
			{
				workBlockPos2 = pBlock->GetPosition() + blockSize;

				if (workBlockPos2.y - blockSize.y < blockPos.y + blockSize.y && workBlockPos2.y + blockSize.y > blockPos.y - blockSize.y
					&& workBlockPos2.x - blockSize.x < blockPos.x + blockSize.x && workBlockPos2.x + blockSize.x > blockPos.x - blockSize.x
					&& workBlockPos2.x - blockPos.x < BLOCK_WIDTH && workBlockPos2.x - blockPos.x > 0.0f)
				{
					workBlockPos2.x = blockPos.x + blockSize.x;
开发者ID:JunMaru,项目名称:Conecton,代码行数:67,代码来源:CGimickBlock.cpp


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