Block object and Utilities class
|
The following was made yesterday and I had no time making a blogpost because now it’s Christmas. So what is have been done.
I have tweaked the GameState since the main focus lies there and not in MenuState och HighscoreState.
I added blocks spawning in a rate of 1*.6 seconds wich will be changed in future. I´ve also added movement to the blocks. I think I have alot more understanding in pointers and iterators now. First I saw an iterator as a usual integer type but with a different name. But now I know that the iterator points an item in the container which is the vector itself.
Luckily, I did not stumbled upon any problems with vectors. I clearly grab this now.
I still don’t get it why you have to do a post increment. ** Google is my friend **
What I still have to do. Calculate width and height and x and y from the block container so that we can safely randomize position for the block itself and add the offsets to the block entities.
Almost forgott to mention about our Utils.
This namespace will hold our most fundemental functions like randomizing, time and type conversion. The Utils has only 3 functions now but I think it will grow bigger as the project developes.
About the random function. Since the rand() is harmful it is not good to rely on that, even in games I say. So that is why I choosed to implement a Mersenne Twister engine and also uniform_int_distribution. Now every number in the range has equally high chance of beeing randomized.
Merry Christmas everyone.
|
