Game-Breaking Pong Glitch

Ok, so I’m working on this Pong game (Flowlab Game Creator - Pong), and I have it mostly working (I even added an AI to play with, although it’s not very good), but the ball keeps getting stuck to/sliding off of the paddles. I have finally found, roughly, how to reproduce this glitch, but I have no idea how to fix it. Basically, if you play against another player (or just control both paddles yourself in Vs. Player mode), and if you have a single round last long enough (amount of time without scoring a point), and if the ball gets fast enough (I don’t know exactly how fast), then once a point is scored, when the ball respawns it begins to cling to the paddles (primarily the left one) and slide off. It has nothing to do with what the score is or the amount of time the game has actually been running (one 2-minute long round may cause it, while ten 20-second long rounds will not cause it). Can anyone figure out why it keeps doing this or how to fix it?

Are you just using the bounce attribute?
A better way to make the ball bounce would be to reverse the x-velocity whenever it hits a paddle

3 Likes

Ok, so I did that here and then turned off its bounce attribute (because without doing that it did a really glitchy thing where it repeatedly slammed into the paddle because it would bounce and then turn back towards that same paddle and repeat). I also went ahead and added one for bouncing off the walls as well, but now it sometimes just hits a wall or paddle it just stops and slides, no bounce. I think what is happening is that it is hitting the object and then the velocity goes to zero as a result of that collision, and then the extractor extracts 0 and tries to turn THAT negative. But I’m not entirely sure how to fix this without derailing my entire code. Maybe I should make something that just automatically gives it the opposite of the speed it’s SUPPOSED to be at instead of its current speed? Maybe using an object variable block?

1 Like

You could set the ball to not be solid but still enable collisions. It then shouldn’t come to a stop when colliding but will still trigger the bounce code

1 Like

Hahaha, IT WORKS!!! Thank you! Now, I wonder if you have any ideas for the slight issue that this solution appears to cause. So it seems that now that the ball isn’t solid, it sometimes appears to be going through the paddles before the collision behaviors kick in, but only once it starts going at really fast speeds. And I’m a little bit concerned that, if the ball somehow ends up going fast enough, perhaps the ball will end up going all the way through before the collision kicks in, which would end up causing it to collide on the OTHER side of the paddle and bounce out, or just completely go through the paddle and hit the point detector. However, the likelihood of a player skilled enough to get it going that fast is very very minuscule, so this is really just an edge case scenario and isn’t really a HUGE concern, but, just in case, do you have any ideas on this?

1 Like

tbh, I can’t really think of anything. If it is basically impossible for anyone to get that far then you shouldn’t need to worry about it

1 Like

Ok, awesome. Thank you so much for your help!

1 Like