I've finally completed my 2nd 2D game, which is a pong game. You should remember my first one which was the Space Shooter one, and all of your nice comments inspired me to make a 2nd game xD. It took approximately 10 - 12 hours to finish this, mainly trying to fix one bug which still IS there but it doesn't disrupt with the game-play as it did before. You may notice it sometimes if you PAUSE the game and then play it after a few seconds. As of now there isn't any sounds because I haven't looked into SFML's Audio module yet.
Move UP: UP Arrow Key
Move DOWN: DOWN Arrow Key
Pause: P Key
I see two issues with the game
1. Is it possible to score any points against cpu? CPU paddle seems to move at y speed of the ball, so I think it is always able to hit the ball
2. After I fail to hit the ball, the ball starts moving from the center to my side at a random angle and sometimes there is simply not enough time to move the paddle and hit the ball, so CPU scores multiple points.
After a long rally with the computer, it still didn't mess up... You need to be able to score for this to be fun. The ball is moving super slow, which is pretty boring. A slight random variance in the angle the ball comes off might be interesting too. I also started the match at 1:0 (pressed space, a point was awarded) before anything had even happened.
@ Null: 1) I've scored only once lol. But that was while I was in the middle of making it, so it probably doesn't count.
2) Umm yep I gotta fix that.
@ Mats: Well the CPU paddle is programmed like this: if ball's y coordinate is less than paddle's, move up. Otherwise, move down. Any ideas on a different movement style so that it can mess up sometimes? Oh and that score thingy is the bug I'm talking about. It is still there sometimes. I've thought of a way to fix it so I'll probably start on it over the weekend (here Fridays and Saturdays).
I'm well aware that CPU is the processor. The thing is that in most games, the computer is referred to as CPU, for example "CPU's move" or something like that. That's why I used the word (or abbreviation to be exact) CPU in this context.
@ Mats: Well the CPU paddle is programmed like this: if ball's y coordinate is less than paddle's, move up. Otherwise, move down. Any ideas on a different movement style so that it can mess up sometimes?
I would make the ball a little bit quicker and the computer paddle speed a little slower. Enough that if you make it have to move a lot, it will not have time to get there. You could also roll a random number after each player hit, say 0-99 and if it comes out 0, the computer could commit an error. i.e. Don't use the same correction algorithm, but use a flawed one that has high chances to miss.
Allright, I've rewritten the game because the previous one was too buggy to be fixed. This time its in Java using Java's SFML binding (JSFML) (I really wanted to try it out). So you can now run it on Windows or Linux without recompiling the source and setting up the library, etc, etc. Now all the previous bugs are fixed. And furthermore, you can now actually score points xD. So enjoy and have fun this time :3.