Liv.Somik
Member
So I'm trying to make this top-down mini golf game that doesn't use room physics.
I have these 2 lines of code to bounce my golf ball in the proper direction when colliding with walls. (all set to solid objects)
if place_meeting(x, y, obj_wallshorizontal) {vspeed = vspeed * -1;}
if place_meeting(x, y, obj_wallsvertical) {hspeed = hspeed * -1;}
They work perfectly most of the time, but I noticed that if the ball goes faster, half of the time the ball just goes through the walls like nothing or sometimes even gets stuck inside them. How should I prevent this from happening?
I have these 2 lines of code to bounce my golf ball in the proper direction when colliding with walls. (all set to solid objects)
if place_meeting(x, y, obj_wallshorizontal) {vspeed = vspeed * -1;}
if place_meeting(x, y, obj_wallsvertical) {hspeed = hspeed * -1;}
They work perfectly most of the time, but I noticed that if the ball goes faster, half of the time the ball just goes through the walls like nothing or sometimes even gets stuck inside them. How should I prevent this from happening?