Functions + Game

anav
2 min readFeb 27, 2021

02/26/21

For this week, I made a variation of the game Pong. Instead of trying to score against the opponent, you have to see how high of a score you can get while keeping the ball bouncing while it speeds up. I used if statements to keep the paddles and ball within the border. I also used if statements to make the ball bounce when it hits the paddle. The ball speeds up by 0.04% every time the draw function is called because ballSpeedZ = ballSpeedZ*1.0004 and every time the ball hits your paddle, your score goes up by 1. If you miss the ball, an if statement catches it and stops all functions while displaying text that says “You Lose”. The meteor function uses beginShape() and endShape() to draw a meteor on top of your ball so it looks like you’re playing pong with a ball of fire.

References

--

--