add inital pacman position

This commit is contained in:
2025-11-10 11:36:20 -05:00
parent a58c19817c
commit 36bbf5b888
3 changed files with 15 additions and 0 deletions
+10
View File
@@ -1,4 +1,5 @@
#include "MazeMap.h"
#include <SFML/System/Vector2.hpp>
bool MazeMap::loadMaze(const std::vector<int>& collisionData,
const std::vector<int>& pelletData,
@@ -102,3 +103,12 @@ void MazeMap::draw(sf::RenderTarget& target, sf::RenderStates states) const {
target.draw(pelletVertices, states);
}
// assumes maze is drawn at 0,0
sf::Vector2i MazeMap::getTileCoords(sf::Vector2f screenPos) {
int tileX = static_cast<int>(screenPos.x / tileSize);
int tileY = static_cast<int>(screenPos.y / tileSize);
return {tileX, tileY};
};