Hi, I was looking for some help to try and understand how i can get a circleshape (SFML Library) to move across the page like how you would find in a game of pong. I have managed to define the settings for the shape as follows:
CircleShape ball;
ball.setRadius(22); // circle size
ball.setPosition(300, 236);
If somebody could please advise or help me understand the logics in trying to get this to move across the screen from right to left.
Sorry for the vague question, want to make sure I have an understanding rather just having the code.
Yanson, thanks for that really appreciate it, managed to add it within my code, and works but got a few questions just to get an understanding of how it works.
I have noticed that if i come out of the window and go back in the speed of the ball reduces and gets slower and slower, what part of the code actually does this?
Also the windowSize is perfect for the ball to bounce off, but what if i was to add a border across all four sides using RectangleShape (example below)