I'm having trouble making Pong from scratch
Basically, I have a create event that sets the speed to 5 and the movement of the ball to be random. I also set the direction of the ball after it hits a paddle in its step event to be random as well. I also set it so the room restarts whenever the ball its the out of frame left and right walls. The top and lower walls end up in the ball bouncing. However, whenever I attempt to run it the ball will bounce off the paddle a couple of times before eventually vibrating out of frame. I'm guessing this is because it hits a certain spot that locks it in a bouncing loop. What should I do? Thanks in advance.
Step Event of ball:
if(place_meeting(x,y,wall_left)){
room\_restart();
}
if(place_meeting(x,y,wall_down)){
direction=irandom\_range(180,0);
}
if(place_meeting(x,y,wall_right)){
room\_restart();
}
if(place_meeting(x,y,wall_up)){
direction=irandom\_range(180,270);
}
if (place_meeting(x,y,paddle_player)){
direction=irandom\_range(0,270);
}
if(place_meeting(x,y,paddle_enemy)){
direction=irandom\_range(180,0);
}