mirror of
https://github.com/dylanbenzi/pacmen-sfml.git
synced 2026-11-27 00:17:01 +00:00
add method to get id of tiles
This commit is contained in:
+5
-3
@@ -132,7 +132,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
int convert2DCoords(int row, int col, int width) {
|
||||
int convert2DCoords(int row, int col) {
|
||||
return col + (row * width);
|
||||
}
|
||||
|
||||
@@ -141,9 +141,11 @@ public:
|
||||
//tileX increases going right
|
||||
//tileY increases going down
|
||||
|
||||
int index = convert2DCoords(tileY, tileX, 28);
|
||||
int index = convert2DCoords(tileY, tileX);
|
||||
|
||||
return 0;
|
||||
int tileId = tiles.at(index);
|
||||
|
||||
return tileId;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -64,6 +64,9 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
int intTileId = mazeMap.getTileId(0, 0);
|
||||
tileId.setString(std::to_string(intTileId));
|
||||
|
||||
window.clear();
|
||||
|
||||
window.draw(map);
|
||||
|
||||
Reference in New Issue
Block a user