Pong Game – Week 2 + Week 4

For week 2 I tried to explore how I could create a bouncing ball and thought about recreating one of my favorite games from when I was a child, the “pong game”. It was challenging to think of the if statements in order for the ball to bounce back every time it hits the paddle as well as using the “keyPressed” function to control the right paddle with the arrows and the keyboard characters “Q” and “A” to control the left paddle. What was also really hard was creating the movement of the bouncing ball and I used only a specific angle for it to move around the canvas for this stage. It was really hard for me to think how I could make make the ball move only inside the “walls” of the canvas and with a random angle every time but will explore how I could work on my pong game and add more features later on.

Code: https://alpha.editor.p5js.org/projects/HkmmS9gT

For week 4 we could work on a previous project and develop it so I took the opportunity to add more features to my pong game. I added sound and a “Game over” sign every time the ball misses the paddle and also randomized the ball’s angle.

Code: https://alpha.editor.p5js.org/projects/HkSPcf70

Leave a Reply

Your email address will not be published. Required fields are marked *