Closed codingbootcampseu closed 3 years ago
Hints
Use a global variable speed to define the speed of the ball.
speed
let speed = 1; function draw() { // other stuff // if ball reaches the end // reset the ball position // increase speed speed = speed + 1; }
Bonus
Use the increment operator ++ to increase the speed.
++
let speed = 1; // The ++ operator adds 1 to a number variable // speed = speed + 1; speed++;
Use the mousePressed() function to reset the speed of the ball when it gets to fast.
mousePressed()
function mousePressed() { speed = 1; }
nach dem bouncing ball, war die Aufgabe ziemlich easy :)
Hints
Use a global variable
speed
to define the speed of the ball.Bonus
Use the increment operator
++
to increase the speed.Use the
mousePressed()
function to reset the speed of the ball when it gets to fast.