CS 1334 The University of Texas at Dallas Pong Ball Project Questions
Question Description
I’m working on a javascript exercise and need support to help me understand better.
Lab Lesson #10 Pong-Ball, part 2
Continuation of game: Pong-Ball!
First: copy / clone your project from Lab 10A.
Make sure you have a new Khan Academy project URL (different from Lab Lesson #10 part 1).
1. Add a paddle:
A. Define a variables: paddleX, paddleY, paddleW, paddleH
B. Write a function: drawPaddle, with input parameters, x, y, w, h.
- This will display a wide rectangle near the bottom of the screen on the ball side.
- Call the drawPaddle function within processing draw( ) function
2. Move the Paddle when arrow keys are pressed
- Add code to move the rectangle with the right/left arrow keys ( this will change the value of paddleX)
3. Check for Collision between Ball and Paddle
In the code, where the ball is bounced off the walls, add code to check if the ball bounces off the paddle-rectangle. You can just check the top of the rectangle
4. 4. Add a score variable and Display the score
- Initialize the score, then display on the non-ball side
- If the ball bounces off of the paddle, add a point to the score
- If the ball bounces off the bottom of the screen, subtract 5 points.
4. 5. Add a reset button
- Define variables: buttonX, buttonY, buttonW, buttonH
- Write a function: drawButton, with input parameters: x, y, w, h. This will display a button on the non-ball side of the game.
- Call the drawButton function within the processing draw( ) function.
- Write logic / code in the processing: mouseClicked( ) function, so that if the mouse is clicked within the buttons borders:
- the score should reset to zero
- the ball array should become empty again
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."