Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Bubble{
- int diameter, x, y;
- Bubble(int d){
- diameter = d;
- x = (int)(Math.random() * width);
- y = (int)(Math.random() * height);
- }
- void display(){
- ellipse(x, y, diameter, diameter);
- }
- void ascend(){
- y--;
- x += (int)(Math.random() * 4 - 2);
- }
- void top(){
- if( y + diameter <= 0 ){
- y = height + diameter/2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement