|
Welcome everyone to another day of hard work and everything that comes with that.
Today, the thirteenth of January, I got some help from one of our student councillors with my previous problem, which to anyone out there with a similar problem is the missing of the SDL.dll file from your debug directory. As well as multiple includes of “SDL.h”, which causes the library and the main to go nuts. So pragma comment SDL2.lib and SDL2main.lib as well as including SDL.h early is advised. However that became the cause of later issues, which will be discussed in a future post.
But to solve the problem the code went a bit like this: 
which you can see involves the main and the engine files.
With this I finally had a “working” project which allowed me to try out new functions et cetera, which meant that I would be going on to try some collision out. And fair enough I got it to work, even though I abandoned my own collision code idea, since it had some flawed logic to it. Which was that it only noticed collision that happened if the right edge of an object was further away from the other objects right edge, which is illustrated on this image. Where the right one would be noticed while the left would just pass right through.

The last thing I noticed today was that I was unable to send through objects to methods, as I was forced to use a pointer instead (first time using a pointer in one of my own classes, beginning to understand them just a bit now). I do not know why I was unable to send an object through a method, though I do recall a second year:er trying to explain it to me, something about the size of the object. (and pointers will always work since they are, as far as I know, always 4 bits in size).
TL:DR
void Engine::CheckPlayerCollision(Asteroid *asteroid) <— works
void Engine::CheckPlayerCollision(Asteroid asteroid) <— does not work
Well that is all for today,
If you have any thoughts, do send a comment, otherwise have a great day!

|