Explode.java
Upload User: kikomiki
Upload Date: 2021-10-31
Package Size: 373k
Code Size: 1k
Category:

Games

Development Platform:

Java

  1. import java.awt.*;
  2. public class Explode {
  3. int x, y;
  4. private boolean live = true;
  5. private TankClient tc ;
  6. int[] diameter = {4, 7, 12, 18, 26, 32, 49, 30, 14, 6};
  7. int step = 0;
  8. public Explode(int x, int y, TankClient tc) {
  9. this.x = x;
  10. this.y = y;
  11. this.tc = tc;
  12. }
  13. public void draw(Graphics g) {
  14. if(!live) {
  15. tc.explodes.remove(this);
  16. return;
  17. }
  18. if(step == diameter.length) {
  19. live = false;
  20. step = 0;
  21. return;
  22. }
  23. Color c = g.getColor();
  24. g.setColor(Color.ORANGE);
  25. g.fillOval(x, y, diameter[step], diameter[step]);
  26. g.setColor(c);
  27. step ++;
  28. }
  29. }