This commit is contained in:
Mylloon 2024-01-08 00:41:02 +01:00
parent e1cd39438f
commit ae6fca99a4
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -32,9 +32,9 @@ void PlateauSafari::afficherPlateau(std::ostream &out, const bool d) const {
elephant.setOutlineThickness(2.);
sf::CircleShape lion(tailleCellule / 3);
lion.setOutlineThickness(2.);
sf::RectangleShape barriereH(sf::Vector2f(tailleCellule / 6, tailleCellule));
sf::RectangleShape barriereH(sf::Vector2f(tailleCellule, tailleCellule / 6));
barriereH.setFillColor(sf::Color::Black);
sf::RectangleShape barriereV(sf::Vector2f(tailleCellule, tailleCellule / 6));
sf::RectangleShape barriereV(sf::Vector2f(tailleCellule / 6, tailleCellule));
barriereV.setFillColor(sf::Color::Black);
sf::CircleShape placeholder(tailleCellule / 5);
@ -117,20 +117,20 @@ void PlateauSafari::afficherPlateau(std::ostream &out, const bool d) const {
Position pos2 = it->getPos2();
const float decalage = 5;
// Verticale
// Horizontale
if (pos1.first == pos2.first) {
const int x = pos1.first;
const int y = std::max(pos1.second, pos2.second);
barriereV.setPosition(x * tailleCellule, y * tailleCellule - decalage);
Ecran::window.draw(barriereV);
barriereH.setPosition(x * tailleCellule, y * tailleCellule - decalage);
Ecran::window.draw(barriereH);
}
// Horizontale
// Verticale
else {
const int x = std::max(pos1.first, pos2.first);
const int y = pos1.second;
barriereH.setPosition(x * tailleCellule - decalage, y * tailleCellule);
Ecran::window.draw(barriereH);
barriereV.setPosition(x * tailleCellule - decalage, y * tailleCellule);
Ecran::window.draw(barriereV);
}
}
@ -158,12 +158,12 @@ bool PlateauSafari::deplacementValideCoor(const int x1, const int y1,
// Plus lointaine position en fonction de l'orientation
std::pair<float, float> posBarriere;
// Verticale
// Horizontale
if (pos1.first == pos2.first) {
posBarriere =
std::make_pair(pos1.first, std::min(pos1.second, pos2.second) + 0.5);
}
// Horizontale
// Verticale
else {
posBarriere =
std::make_pair(std::min(pos1.first, pos2.first) + 0.5, pos1.second);