Rename damagable to vulnerable so they can be distinguished easily.
This commit is contained in:
parent
bc68de5b99
commit
fc87ef9da8
|
@ -45,7 +45,7 @@ public abstract class LivingEntity extends CollidableEntity implements Hittable
|
|||
/**
|
||||
* Whether the LivingEntity will take damage.
|
||||
*/
|
||||
private boolean damagable;
|
||||
private boolean vulnerable;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public abstract class LivingEntity extends CollidableEntity implements Hittable
|
|||
*/
|
||||
public LivingEntity(int x, int y) {
|
||||
super(x, y);
|
||||
this.setDamagable(true);
|
||||
this.setVulnerable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -243,19 +243,19 @@ public abstract class LivingEntity extends CollidableEntity implements Hittable
|
|||
}
|
||||
|
||||
/**
|
||||
* Set whether the LivingEntity is damagable.
|
||||
* Set whether the LivingEntity is vulnerable.
|
||||
* This defaults to true on construction and will only be changed manually.
|
||||
*/
|
||||
public void setDamagable(boolean damagable) {
|
||||
this.damagable = damagable;
|
||||
public void setVulnerable(boolean vulnerable) {
|
||||
this.vulnerable = vulnerable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the LivingEntity is damagable.
|
||||
* Whether or not the LivingEntity is vulnerable.
|
||||
* This defaults to true on construction and will only be changed manually.
|
||||
*/
|
||||
public boolean getVulnerable() {
|
||||
return this.damagable;
|
||||
return this.vulnerable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class Player extends ShootingEntity implements KeyboardListener {
|
|||
if(this.currentCollisionCooldown > 0) {
|
||||
this.currentCollisionCooldown--;
|
||||
} else {
|
||||
this.setDamagable(true);
|
||||
this.setVulnerable(true);
|
||||
this.setDamaging(true);
|
||||
}
|
||||
int offset = 3;
|
||||
|
@ -139,7 +139,7 @@ public class Player extends ShootingEntity implements KeyboardListener {
|
|||
super.collideWith(entity);
|
||||
if(this.currentCollisionCooldown == 0 && (entity instanceof Enemy || entity instanceof Obstacle)) {
|
||||
this.currentCollisionCooldown = this.collisionCooldown;
|
||||
this.setDamagable(false);
|
||||
this.setVulnerable(false);
|
||||
this.setDamaging(false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue