The code is not properly formatted, but I think you only need to change bounce() method, now it will bounce from left and right but after falling to the bottom of the screen it will reappear on top.
Thanks a lot for your answer. It worked well. how could i change the shape of the ball to make it look like an apple please ? where do i need to change and any suggestions?
You can make a shape you like, using shape and verticies. However, I recommend you to find an image of apple and use it - less headache and better look.
Answers
First helpful thing: https://forum.processing.org/two/discussion/8045/how-to-format-code-and-text#latest
The code is not properly formatted, but I think you only need to change bounce() method, now it will bounce from left and right but after falling to the bottom of the screen it will reappear on top.
Also, there is a suggestion - you use 4 variables for 4 balls, read on how to use array instead of several variables.
Thanks a lot for your answer. It worked well. how could i change the shape of the ball to make it look like an apple please ? where do i need to change and any suggestions?
You can make a shape you like, using shape and verticies. However, I recommend you to find an image of apple and use it - less headache and better look.