Sunday, October 6, 2013

Pong!

This week's main project was to tackle the arcade classic "Pong." Where as you probably know, you play a game of back and forth, trying to score goals, similar to air hockey. A very important discovery that my partner and I made was that you cannot move smoothly using "when key pressed" commands, and that it works better if you use "If key pressed." Not only does it move smoother, it is impossible to move both at once if you use the "when key pressed" blocks. The ball moves back and forth between the two paddles, it starts going at 90 degrees, and then when it comes in contact with a paddle, the direction is multiplied by -1, and by a variable called "Speed." Speed is determined by every 10 steps the paddle moves Rawspeed being multiplied by 2, and then having Rawspeed divided by 5 in order to determine speed. This is to make it so the speed of the paddle has a direct effect on the direction the ball goes. There are a few bugs with this, but the most noticeable one is that the ball tends to get stuck inside the paddle, and scores a goal even though the player shouldnt have had a goal scored on them. The most important thing I learned from this project is the moving function earlier, without that knowledge creating this game and other games in the future would be impossible.


W: Left Paddle Up
S: Left Paddle Down
Up Arrow: Right Paddle Up
Down Arrow: Right Paddle Down

No comments:

Post a Comment