KreakOut #3 – Since when could I get collisions to work?
|
Lately I’ve worked with collision detection and it’s actually going better than expected. The ball travels the way it should without any bigger problems.
To find out what side the collision was made on (so the direction would be correct), I had to start checking the offset and that was solved with a couple of if/else without any problems at all actually (to my big surprise). Next step was changing the directions depending on where on the paddle the ball hits (would get pretty boring else). This was a pain in the ass to make and I’m still not completely sure how I suddenly got it to work after a day of trial and error, but eventually it all worked out (sort of).
Right now I check the center of both the player and the ball and then simply changing the ball’s direction depending on how big the difference was. If you manage to get the ball to hit the middle of the paddle, the current direction will be halved. How it looks right now And btw, I got images to work again! Woohoo! |


