Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- public class Bubble
- {
- // instance variables
- Color c;
- int r;//radius
- int xSpeed;
- int ySpeed;
- boolean show;//is visible
- int x;
- int y;
- public Bubble()
- {
- // Initialize instance variables
- int red = produceRandom(0,255);
- int g =produceRandom(0,255);
- int b = produceRandom(0,255);
- xSpeed = produceRandom(-10,10);
- ySpeed = produceRandom(-10,10);
- c = new Color(red,g,b);
- r = produceRandom(2,25);
- show = false;
- }
- public void setLocation(int x, int y){
- this.x = x;
- this.y = y;
- show = true;
- }
- public int produceRandom(int min, int max)
- {
- // put your code here
- return (int)(Math.random() * ((max - min) + 1)) + min;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement