Guest User

Untitled

a guest
Jul 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // DOT EXERCISE
  2. // THISNEWMEDIA.TUMBLR.COM
  3.  
  4. float yPos;
  5. int myHeight = 800;
  6. int myWidth = 400;
  7. float speed = 0;
  8. float gravity = 0.1;
  9.  
  10. void setup() {
  11. size(800,400);
  12. background(120);
  13. smooth();
  14. }
  15.  
  16. void draw() {
  17. background(120);
  18. noStroke();
  19. yPos+=speed;
  20. speed+=gravity;
  21.  
  22. if (yPos > height || yPos < 0) {
  23. speed = speed * -0.95;
  24. }
  25.  
  26. ellipse(width/2,yPos,40,40);
  27. }
Add Comment
Please, Sign In to add comment