Advertisement
fosterbl

Bubble without objects

Oct 23rd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. float x;
  2. float y;
  3.  
  4. void setup(){
  5.  size(640,480);
  6.  x = width/2;
  7.  y = height/2;
  8. }
  9.  
  10. void draw(){
  11.   background(255);
  12.   display();
  13.   ascend();
  14.   top();
  15. }
  16.  
  17. void display(){
  18.   stroke(0);
  19.   strokeWeight(2);
  20.   fill(127);
  21.   ellipse(x, y, 50, 50);
  22. }
  23.  
  24. void ascend(){
  25.   y--;
  26. }
  27.  
  28. void top(){
  29.   if( y <= -20 ) y = height+20;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement