[Development] Hooded Development #3
+Added Graphics Manager
+Refactored some lazy code
I'll start off with first one. I have added a Graphics manager that is responsible for containing the current Tiles for the screen's "board". (In SFML, Sprites and Images are divided. So for display purposes, I need an array of sprites whose images change depending on the position of the player. Thus, the map is updated every time the player moves.) There's a struct called Tile who contains a Tile's image, a Tile's Sprite, and a Tile's Type (labeled terrain). So the idea is that my Graphics Manager class has a 2 dimensional vector of Tiles which I change whenever the player moves.
I'm taking an approach where the player has 2 hit-boxes making it possible for him to go between tiles (No slopes for the win (Maybe next time (This is getting really nested ))). My Collision class will handle collision, and if it finds collision it'll pass a set of points and a type of collision to my Physics class, which is responsible for determining the physics (Where the player should end up when they collide with a block / Figuring out Velocity and doing Algebra problems, the general stuff). Physics will determine where the Player should be. For pure ease of use, readability, and expansiveness purposes, there is a separate class that handles movement which the Physics class calls. Then, my Graphics Manager's Map will be set and it'll render everything where it should be.
Now to move on to the elephant in the room, the second one. My code for the Graphics Manager and the Map manager was pretty bad, so I'm still refactoring (I really didn't think through my Map ). Overall, I believe that development is coming along (albeit pretty slowly, I keep on browsing the web trying to figure things out.)
I believe these development posts are really helping me get my thoughts together and continue development. Any recommendations for handling things and / or corrections are welcome in the comments below. cheers !