Microsoft Word - Document4 CREATE A SIMPLE PONG GAME WHILE USING THESE REQUIRMENTS, PLEASE WRITE A SHORT EXPLAINATION OF WHAT YOU WISH TO ACHIEVE PLEASE WRITE NOTES EXPLAING EVERY STEP OF THE CODE ALL...

1 answer below »
Create a simple pong game, see attached requirements and example videoAll code must be done in processing software, free software download on processing.orgPlease write notes explaining each step of code


Microsoft Word - Document4 CREATE A SIMPLE PONG GAME WHILE USING THESE REQUIRMENTS, PLEASE WRITE A SHORT EXPLAINATION OF WHAT YOU WISH TO ACHIEVE PLEASE WRITE NOTES EXPLAING EVERY STEP OF THE CODE ALL CODE MUST BE DONE IN PROCESSING SOFTWARE, FREE DOWNLOAD AVAILABLE ON processing.org SUBMIT the zipped file of the folder that has the usage sketch and the Class file(s). DO NOT submit as individual files. 1. createoneClass-defineaClassforthemainobjectinyourproject. a. declaretheattributes. b. writeconstructor(s)-thereshouldbeaminimumofone constructor. c. writemethodsthatshouldbeprovidedbyyourobject(displayand othermethodsyourprojectmayneedfortheusagesketchto interactwithit). 2. intheusagesketch: a. createonlyoneinstanceoftheClassanddisplayit-DONOT createanarrayofinstancesforyourClass(e.g.ifyouhadmultiple ballsinyourproject,createonly1instanceofBall). b. dependingonyourproject,theusagesketchmayrequireyouto writecodeinsidedrawormousefunctionsorkeyboardfunctions-if so,thenthosecodeshouldbethere. c. theinstancethatyoucreatedinstep2shouldbehaveas expected.
Answered Same DayNov 09, 2021

Answer To: Microsoft Word - Document4 CREATE A SIMPLE PONG GAME WHILE USING THESE REQUIRMENTS, PLEASE WRITE A...

Amar Kumar answered on Nov 10 2021
135 Votes
Ball ball; // Define the ball as a global object
Paddle paddleLeft;
Paddle paddleRight;
int scoreLeft = 0;
int scoreR
ight = 0;
void setup(){
size(800,600);
ball = new Ball(width/2, height/2, 50); //create a new ball to the center of the window
ball.speedX = 5; // Giving the ball speed in x-axis
ball.speedY = random(-3,3); // Giving the ball speed in y-axis

paddleLeft = new Paddle(15, height/2, 30,200);
paddleRight = new Paddle(width-15, height/2, 30,200);
}
void draw(){
background(0); //clear canvas
ball.display(); // Draw the ball to the window
ball.move(); //calculate a new location for the ball
ball.display(); // Draw the ball on the window

paddleLeft.move();
paddleLeft.display();
paddleRight.move();
paddleRight.display();

if (ball.right() > width) {
scoreLeft = scoreLeft + 1;
ball.x = width/2;
ball.y = height/2;
}
if (ball.left() < 0) {
scoreRight = scoreRight + 1;
ball.x = width/2;
ball.y = height/2;
}
if (ball.bottom() > height) {
ball.speedY = -ball.speedY;
}
if (ball.top() < 0) {
ball.speedY = -ball.speedY;
}

if (paddleLeft.bottom() > height) {
paddleLeft.y =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here