[Added] Start of player class, start of collision detection

This commit is contained in:
Ninjaws
2024-12-10 19:26:48 +01:00
parent 97d93ab113
commit 774dc3806b
18 changed files with 433 additions and 50 deletions
+13 -3
View File
@@ -3,6 +3,8 @@
#include <vector>
#include "raylib.h"
#include "entities/TextureWrapper.h"
#include <cmath>
/**
* Holds the collision and texture maps for the game world
@@ -15,19 +17,27 @@ public:
void draw();
/** Checks and returns which corners of the object have been collided with */
std::unordered_map<ECorner, bool> checkForCollision(TextureWrapper texture);
private:
/** Holds the number for every single tile, which refers to a certain sprite in the tileset */
std::vector<std::vector<Vector2>> map;
/** Holds 1s (collision) and 0s (no collision) for every tile */
/** Holds 1s (collision) and 0s (no collision) for every tile */
std::vector<std::vector<int>> colMap;
float tileSize = 32;
unsigned int tileSize = 32;
Texture2D tileset;
void loadMap();
void loadColMap(){}
void loadColMap();
void loadTileset();
/**
* Converts the corners of the object to the matching tiles, so that they can be checked for collision
*/
std::unordered_map<ECorner, Vector2> cornersToTilePos(std::unordered_map<ECorner, Vector2> corners);
};
#endif