Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import java.awt.Color;
  2.  
  3. public class Bubble
  4. {
  5. // instance variables
  6. Color c;
  7. int r;//radius
  8. int xSpeed;
  9. int ySpeed;
  10. boolean show;//is visible
  11. int x;
  12. int y;
  13.  
  14. public Bubble()
  15. {
  16. // initialise instance variables
  17. int red = produceRandom(0,255);
  18. int g =produceRandom(0,255);
  19. int b = produceRandom(0,255);
  20. xSpeed = produceRandom(-10,10);
  21. ySpeed = produceRandom(-10,10);
  22. c = new Color(red,g,b);
  23.  
  24. r = produceRandom(2,25);
  25. show = false;
  26. }
  27.  
  28.  
  29. public void setLocation(int x, int y){
  30. this.x = x;
  31. this.y = y;
  32. show = true;
  33. }
  34.  
  35. public int produceRandom(int min, int max)
  36. {
  37. // put your code here
  38. return (int)(Math.random() * ((max - min) + 1)) + min;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement