Example #1
0
	bool TestPlatCollision(sf::IntRect rect)
	{
		for (int i = 0; i < tiles.size(); i++)
			for (int j = 0; j < tiles[i].size(); j++)
				if (rect.intersects(tiles[i][j]->Rect()) && tiles[i][j]->IsSolid)
					return true;
		return false;
	}
Example #2
0
void ButtonMenu::onClickListener(GameState::GameStates &state, sf::IntRect rect){
	for(int i = 0; i < m_buttons.size(); i++){
		if(rect.intersects(m_buttons[i]->getButtonRect())){
			state = m_buttons[i]->getGameState();
		}else{
			m_buttons[i]->setColor(sf::Color::Blue);
		}
	}
}
Example #3
0
void ButtonMenu::mouseOver(sf::IntRect rect){

	for(int i = 0; i < m_buttons.size(); i++){
		if(rect.intersects(m_buttons[i]->getButtonRect())){
			m_buttons[i]->setColor(sf::Color::Magenta);
		}else{
			m_buttons[i]->setColor(sf::Color::Blue);
		}
	}
}
Example #4
0
bool DeathWall::checkIfHitDeathBlock(sf::IntRect playerRect){
	for(Wall::size_type i = 0; i < deathWall.size(); i++){
		sf::IntRect rect;
		rect.left = static_cast <int>(deathWall[i]->getX());
		rect.top = static_cast <int>(deathWall[i]->getY());
		rect.width = static_cast <int>(deathWall[i]->getWidth());
		rect.height = static_cast <int>(deathWall[i]->getHeight());

		if(playerRect.intersects(rect))
			return true;
	}
	return false;
}