コード例 #1
0
bool tryMove(int x, int y, int testX, int testY, Entity& entity){
	if(checkMapCollision(entity.getX()+x, entity.getY()+y, testX, testY) == 1){
		entity.move(entity.getX()+x, entity.getY()+y);
		return true;
	}else if(checkMapCollision(entity.getX()+x, entity.getY()+y, testX, testY) == 2){
		entity.setDead(true);
		return true;
	}
	return false;
}
コード例 #2
0
void Bullet::update()
{
	checkBulletsObjectsCollision();
	checkMapCollision();
	if (!m_bDying)
	{
		move();		
	}
	else
	{
		doDyingAnimation();
	}	
}
コード例 #3
0
void Player::move()
{
	m_velocity.setX(0);
	m_velocity.setY(0);
	handleInput();
	// check for move capacity
	m_canMove = true;
	checkMovePosible();	
	checkObjectsCollision();
	checkMapCollision();
	//------------------------------
	
	if (m_canMove)
	{		
		m_position += m_velocity;		
		
	}
	
}