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; }
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); } } }
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); } } }
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; }