Advertisement
Nojus_Globys

3 | bounce

Oct 24th, 2022 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | Software | 0 0
  1. float
  2.   y = 50,
  3.   step = 5.0,
  4.   gravity = 0.2;
  5. int repeat = 10;
  6.  
  7. void setup () {
  8.     size(1280, 747);
  9.     noStroke();
  10. }
  11.  
  12. void draw () {
  13.     background(0);
  14.     y += step;
  15.     step += gravity;
  16.     if (y > height) {
  17.         step *= -0.9;
  18.         --repeat;
  19.     }
  20.     if (repeat < 0)
  21.         noLoop();
  22.     fill(255);
  23.     circle(width/2, y, 50);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement