class Explosion { Vector2D position; int size; int maxSize; //Color color int type = 1; //1 - bug dies, 2 - bullet public Explosion(Vector2D position_, int size_, int type_) { position = position_; size = size_; type = type_; maxSize = 7 * size; //color = color_; } void draw(int i) { stroke(60, 50, 40); ellipse(position.getX(), position.getY(), size, size); if (type == 1) { stroke(80, 50, 40); ellipse(position.getX(), position.getY(), size + 10, size + 10); strokeWeight(2); stroke(100, 50, 40); ellipse(position.getX(), position.getY(), size + 20, size + 20); stroke(120, 60, 40); ellipse(position.getX(), position.getY(), size + 30, size + 30); strokeWeight(1); } size += 3; } int clean(int i) { if (size > maxSize) { explosions = removeArrayItem(i, explosions); return 1; } return 0; } } public Explosion[] removeArrayItem(int index, Explosion[] items) { if(index < explosionsCount) { items[index] = null; for(int i = index + 1;i < explosionsCount; i++) { items[i - 1] = items[i]; } explosionsCount--; } return items; }