Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Lab Lesson #10 – Pong-Ball, part 1 We're going to make a game: Pong-Ball! 1

Lab Lesson #10 – Pong-Ball, part 1 We're going to make a game: Pong-Ball! 1

Computer Science

Lab Lesson #10 – Pong-Ball, part 1 We're going to make a game: Pong-Ball! 1. Use rectangles to divide the screen into two areas ? The narrow left side of the screen for buttons and scores ? The wide right part of the screen for the game action ? I would suggest the "narrow" part of the screen be ~1/3 the size of the wide part of the screen (but it's up to you) 2. Add balls ? Use arrays to hold the xPosition, yPosition, xSpeed, ySpeed, and color of each ball ? That's 5 arrays... ? the balls should be ~5 pixels wide, maybe a little more if you have a thick stroke on the ellipse 3. Move the balls ? At each call of the draw function draw each of the balls ? At each call of the draw function update the xPosition by the xSpeed and the yPosition by the ySpeed 4. Make the balls bounce ? If the ball hits the wall (defined by the wide rectangle) it should bounce ? If it hits the left or right wall the xSpeed should reverse ? If it hits the top or bottom wall the ySpeed should reverse 5. Make the bounce wobble ? Whenever the ball bounces take a random amount (between -0.5 and 0.5) and subtract it from the xSpeed and add it to the ySpeed 6. Every 30 seconds (or so) randomly add a new ball 7. As always, save your code and submit the link on e-learning. Lab Lesson #10 – Pong-Ball, part 2 This week we continue our game: Pong-Ball! First make a copy of your game. Make sure you have a new URL (different from Lab Lesson #10 – part 1). 1. Add a paddle ? Create a wide rectangle towards the bottom of the screen on the "ball" side ? Add code to move the rectangle with the right/left arrow keys ? in the code where the ball is bounced off of the walls, check to see if the ball bounces off of the rectangle as well (you should just need to check the top of the rectangle) 2. Add a score ? Start the score at 0 and display on the "non-ball" side ? if the ball bounces off of the paddle add a point ? if the ball bounces off of the bottom of the screen subtract 5 points 3. Add a reset button ? Add a button to the "non-ball" side ? When clicked (with the mouse) the score should reset to zero, and the ball array should become empty again If you have time: ? ? ? ? Add background and decorations Have the size of the paddle change over time Have the speed of the balls change over time Have the player score more points when the ball is faster and/or the paddle is smaller CS1134 Lab Assignment Submission Form Grading Guidelines: Labs are graded according to the following guidelines: 1. 2. 3. 4. Correct submission content and format Code comments – describe code details Well organized and structured code Assignment specific requirements Student Name Your Name Here Section Your Section Number ( 1U1) Lab Number / Title Lab Assignment 1 – Color Wheel Link to Code your_web Link_here (your saved project in KhanAcademy.org) Screenshot Image Copy/Paste Code 10 points 10 points 5 points 75 points Paste code below table Paste code below:

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions