feat: add working shapes
This commit is contained in:
@@ -265,13 +265,13 @@ void World::cleanDeadMobs() {
|
||||
TowerPtr World::getTower(const glm::vec2& position) const {
|
||||
for (TowerPtr tower : m_Towers) {
|
||||
if (tower->getSize() == TowerSize::Big) {
|
||||
if (tower->getX() - 2 <= static_cast<std::int32_t>(position.x) && tower->getX() + 2 >= static_cast<std::int32_t>(position.x) &&
|
||||
tower->getY() - 2 <= static_cast<std::int32_t>(position.y) && tower->getY() + 2 >= static_cast<std::int32_t>(position.y)) {
|
||||
if (tower->getCenterX() - 2.5f < position.x && tower->getCenterX() + 2.5f > position.x &&
|
||||
tower->getCenterY() - 2.5f < position.y && tower->getCenterY() + 2.5f > position.y) {
|
||||
return tower;
|
||||
}
|
||||
} else {
|
||||
if (tower->getX() - 1 <= static_cast<std::int32_t>(position.x) && tower->getX() + 1 >= static_cast<std::int32_t>(position.x) &&
|
||||
tower->getY() - 1 <= static_cast<std::int32_t>(position.y) && tower->getY() + 1 >= static_cast<std::int32_t>(position.y)) {
|
||||
} else { // little tower
|
||||
if (tower->getCenterX() - 1.5f < position.x && tower->getCenterX() + 1.5f > position.x &&
|
||||
tower->getCenterY() - 1.5f < position.y && tower->getCenterY() + 1.5f > position.y) {
|
||||
return tower;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user