mirror of
https://github.com/dylanbenzi/pacmen-sfml.git
synced 2026-11-27 08:26:59 +00:00
add inital pacman position
This commit is contained in:
@@ -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};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user