コード例 #1
0
//checks for trap collisions
void PlayerActor::doTrapCollision(float* nextX, float* nextY)
{
	//loop through the traps and check collision
	vector<Trap*>* traps = dxMan->GetTraps();
	for(vector<Trap*>::iterator iter = traps->begin(); iter != traps->end(); ++iter)
	{
		Trap* trapTest = *iter;
		bool hit = TestTrapCollision(trapTest, nextX, nextY);
		if (hit)
		{
			//check if trap is dangerous at this time
			if(trapTest->trapWillKill() || trapTest->trapType == 3)
			{
				trapTest->OnPlayerCollide(this);
			}
		}
	}
}