mirror of
https://github.com/dylanbenzi/pacmen-sfml.git
synced 2026-11-27 08:26:59 +00:00
add initial ghost logic
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "MazeMap.h"
|
||||
#include "Entity.h"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <cmath>
|
||||
|
||||
bool MazeMap::loadMaze(const std::vector<int>& collisionData,
|
||||
const std::vector<int>& pelletData,
|
||||
@@ -265,3 +267,11 @@ void MazeMap::handleTunnelWrapping(Entity& entity) {
|
||||
entity.setPosition({newX, pos.y});
|
||||
}
|
||||
};
|
||||
|
||||
float MazeMap::distanceBetweenTiles(sf::Vector2i t1, sf::Vector2i t2) {
|
||||
sf::Vector2i delta = {t1.x - t2.x, t1.y - t2.y};
|
||||
|
||||
float distance = std::sqrt(delta.x * delta.x + delta.y * delta.y);
|
||||
|
||||
return distance;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user