Pong CE
You have not uploaded your program! Please edit the page to upload your program.
|
|||||||||||||||
Pong for CE calculators. Includes a Versus CPU game mode AND a high score mode. (High scores are not recorded) Use the arrow keys to move the paddle, 2nd to pause the game, and enter to resume the game. Version 2.0 includes an option for the user to choose the color of the paddle, as well as overall improvements to the game. |
What the community thinks:
Here is a working Pong for CE calculators (Note that this will NOT work on CSE calculators).
Might I ask how fast the game is able to run? I tried throwing a simple version together on my CE in my study hall today and it was functional but really slow.
Here's the code, with just the game loop and a basic AI for the second player.
Also, are the Wait commands the only thing stopping a port to CSE? Cause there are other ways to cause delays that work on older OS's.
The solution to a complex problem is often a simple answer.
I had issues with speed at first, when the program had a whole bunch of glitches. I got the program to run faster after I fixed the glitches. I stored important values to variables and had conditionals check the value of the variables to determine which direction the ball should move, and which direction the AI should move. (Competent AI is hard to make, by the way). I had to keep the conditionals simple to make the program fast, but that was something I could work with.
As far as I can see, the Wait commands are the only thing preventing the program from running on a CSE. I did that intentionally, because I felt that using the Wait command would be more efficient than a different method. Someone could easily change those lines of code and have a working Pong game on a CSE. I'm pretty sure there are other CE exclusive commands, but I believe Wait is the only one I used.
EDIT: How did you choose to make the ball to move? I'm curious about the methodology of your movement math, since I didn't do what I originally planned on doing with the ball's movement.
My movement math is fairly simple: The ball has an X and Y velocity, stored as P and Q. The ball's coords change by P and Q each frame. When the ball hits a surface (either the floor/ceiling or paddles), the velocity for that direction is negated. The other velocity component is unaffected.
So, if the ball hits the floor, its downward Y velocity is negated (-Q→Q) to become upward velocity. If it hits your paddle, its rightward X velocity is negated (-P→P) to become leftward velocity.
The solution to a complex problem is often a simple answer.
Ok. That's what I did, where either 5 or -5 was stored to the velocity variables. I was originally going to use trig, but I quickly decided that wouldn't be a practical method.