1b: default values, constructor with fewer params

This commit is contained in:
Daniel Langbein 2024-11-19 11:43:30 +01:00
parent 7a9956fb63
commit 5bb81a4e65
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -19,51 +19,19 @@ public abstract class DisplayableElementModel {
private final boolean destructible;
private final boolean moving;
private boolean animate;
private boolean impactExplosive;
private int priority;
private boolean falling;
private boolean convertible;
private String collideSound;
private boolean animate = false;
private boolean impactExplosive = false;
private int priority = 0;
private boolean falling = false;
private boolean convertible = false;
private String collideSound = null;
private BufferedImage sprite;
/**
* Class constructor
*
* @param destructible Object destructible?
* @param moving Object is moving?
* @param spriteName Object sprite name?
* @param priority Object priority?
* @param impactExplosive Object explodes on impact?
* @param animate Object can be animated?
*/
public DisplayableElementModel(boolean destructible, boolean moving, String spriteName, int priority,
boolean impactExplosive, boolean animate, boolean falling, String collideSound,
boolean convertible) {
this.moving = moving;
this.destructible = destructible;
this.spriteName = spriteName;
this.animate = animate;
this.impactExplosive = impactExplosive;
this.priority = priority;
this.falling = falling;
this.convertible = convertible;
this.collideSound = collideSound;
}
private DisplayableElementModel(boolean destructible, boolean moving, String spriteName,
int priority, boolean impactExplosive, boolean animate,
boolean falling, String collideSound) {
this(destructible, moving, spriteName,
priority, impactExplosive, animate,
falling, collideSound, false);
}
public DisplayableElementModel(final String spriteName, boolean destructible, boolean moving){
this(destructible, moving, spriteName,
0, false, false,
false, null);
this.spriteName = spriteName;
this.destructible = destructible;
this.moving = moving;
}
public DisplayableElementModel(final String spriteName){