AssetManager and a collision fix

So this week I have worked with making the bad collision boxes work better. For you who don’t know what the problem is, let me take you through it a little quick.
When the player walks into the hit boxes on the sides they only collided with the right side of the hit boxes. After looking several times I got help from a good friend that helped me with the LevelManager to take a look over the class with me and see what was wrong. He guessed that the error occurred because we had used: Unsigned int
a unsigned int is a int (piece of data that only contain complete numbers) and a unsigned int can’t contain negative valued numbers.

So the problem was that some of the hitboxes are negative in value and that is why the hitboxes did not work.

Asset manager:

The asset manager, work really close to how the levelmanager does. You take in a *.txt file, that file contains a number of how many assets that will exist.

The first thing that will be added on the asset is what map it will be in.
Then you write in a string containing the sprites location or if it’s something without a sprite the string will say ”null”. Then you add a flag that tells if it’s a object you can collide with, if it’s not collide able, if it’s a health pack or if it’s a overcharge power up. The last thing you add into the *.txt file is a number. That number represent the position in a std::vector.

The asset manager then works into adding all the things that are suppose to be on the current map and only adds those items into a vector so that we don’t have to go through a longer string.

I will tell you this much making this class work was a lot harder than I thought. At first I got many errors and when I thought it was gone it soon returned. Much of the trouble came from that I forgot to check if the vector that many tiles to walk on before I set spawn point.

The result with that was that I tried to add a empty space into something that needed to be emptied. If you don’t really understand what I am talking about. It’s like adding in a nullptr and then trying to remove the nullptr. and the nullptr is completly empty to begin with.

So what does the Asset manager do?

AssetManager

It handles all the assets that we want to add like, chairs, blood, a health pack or overcharge. Then it adds them at the place that is walk able, it draws the item and as of right now it is checking the collision as  well. Depending on the map it draws the item differently.

That is about it. Have a good day or night 😛

For more question write in the comment section bellow.