You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
817 B

/**
* Copyright 2022 Jamie Munro, All rights reserved
* CS5041 P1
* Game 1
*/
public class Bomb {
private final Configuration conf;
public final int x;
public final int y;
private int expansion;
private boolean out;
public Bomb(int x, int y, Configuration conf) {
this.conf = conf;
this.x = x;
this.y = y;
this.expansion = 0;
this.out = true;
}
public int getExpansion() {
return this.expansion;
}
public float getDiameter() {
return map(this.expansion, 0, 100, 0, 1.5*conf.viewportWidth);
}
public boolean update() {
if (out) {
expansion += conf.bombSpeed;
if (expansion == 100) out = false;
}
else {
expansion -= conf.bombSpeed;
if (expansion == 0) return true;
}
return false;
}
}