예제 #1
0
void Enemy::update()
{
	Animation::update();
	SDL_Rect previousState = pos;
	
	if (!isPlaying)//If not going to die 
	{
		pos.x += moveSpeed * direction.first;
		pos.y += moveSpeed * direction.second;
	}
	

	if (Physics::checkCollision(mms->curMap->mapCollider, pos))
	{
		pos = previousState;
		direction.first = -direction.first;
		direction.second = -direction.second;
	}

	if ( mms->bomb != nullptr && mms->bomb->getInteraction(*this) == BombCharStatus::COLLISION )
	{
		pos = previousState; 
		direction.first = -direction.first;
		direction.second = -direction.second;
	}

	turnRandom();
	if (getCurFrame() == noOfFrames - 1 )
	{
		isDead = true;
	}
	
}
예제 #2
0
파일: responders.c 프로젝트: crenshaw/upbot
/**
 * respondTurn
 *
 * Turns the robot a random amount
 */
void respondTurn(void) {
   turnRandom(300000,1800000);
}