Adding Movement to Pong

The last couple of days, I’ve been reading the SDL documentation very closely hopefully to learn how to put the finishing touches on Pong. Things are really starting to get complicated now but more interesting too. The code for Pong is getting rather long and convoluted and I still have to research collision detection. For the sake of simplicity, I’m going to redo some parts using C++ classes. Since the last post, I’ve been able to successfully add a Sprite class and have implemented movement for both the paddles but not for the ball. I’ve uploaded a video showing the game at its latest stage. Both paddles can now move up and down; the right paddle uses the arrow keys and the left paddle uses the W and X keys. The movement is also bounded by the top and bottom of the screen. I haven’t got enough time right now to post all the source code and what it does, but I did upload the latest source .cpp file which can be downloaded from here.

Leave a Reply