• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Help with Brick Breaker collisions

W

Wicked

Guest
I am pretty new to GML and Game Maker in general, and have been following the tutorials to learn up on it, however I am having issues with the collision of the ball and the brick. The ball will only go in the opposite direction of the original bounce (like 95% of the time) even though I changed the code to ensure that it would not be the case.


move_bounce_all(true);
if speed < 12 speed += 0.1;
global.player_score = +15
audio_play_sound(snd_Break, 0, false);
instance_destroy(other);

this is the code I have with it currently, removed the variable stuff to see if it would fix it but it didn't help


Any help is greatly appreciated!!
 
I dont like the move_bounce_all function. You have zero control over it. If your bricks are all square you should instead check if there is a collision on the y-axis (above or bellow) and then only reverse the vspeed, and do the same for the x-axis.
If you have bricks that have angels, I think the best way, (but pretty difficult) would be to give each brick an array of points. These points will outline the shape of the brick. Then use math to find the normals of the collision.
 
Top