1b: chained constructor with default values

This commit is contained in:
Daniel Langbein 2024-11-19 09:51:07 +01:00
parent cb6b7513aa
commit d937090e5f
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
4 changed files with 17 additions and 14 deletions

View File

@ -11,10 +11,7 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/ */
public class CursorModel extends DisplayableElementModel { public class CursorModel extends DisplayableElementModel {
CursorModel() { CursorModel() {
super(false, false, "cursor", super("cursor");
0, false, false,
false, null);
this.loadSprite("cursor"); this.loadSprite("cursor");
} }
} }

View File

@ -49,7 +49,9 @@ public abstract class DisplayableElementModel {
* @param impactExplosive Object explodes on impact? * @param impactExplosive Object explodes on impact?
* @param animate Object can be animated? * @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) { public DisplayableElementModel(boolean destructible, boolean moving, String spriteName, int priority,
boolean impactExplosive, boolean animate, boolean falling, String collideSound,
boolean convertible) {
this.moving = moving; this.moving = moving;
this.destructible = destructible; this.destructible = destructible;
this.spriteName = spriteName; this.spriteName = spriteName;
@ -63,7 +65,17 @@ public abstract class DisplayableElementModel {
public DisplayableElementModel(boolean destructible, boolean moving, String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, String collideSound) { public DisplayableElementModel(boolean destructible, boolean moving, String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, String collideSound) {
this( this(
destructible, moving, spriteName, priority, impactExplosive, animate, falling, collideSound, false destructible, moving, spriteName,
priority, impactExplosive, animate,
falling, collideSound, false
);
}
public DisplayableElementModel(final String spriteName){
this(
false, false, spriteName,
0, false, false,
false, null
); );
} }

View File

@ -11,10 +11,7 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/ */
public class DoorModel extends DisplayableElementModel { public class DoorModel extends DisplayableElementModel {
DoorModel() { DoorModel() {
super(false, false, "door", super("door");
0, false, false,
false, null);
this.loadSprite("door"); this.loadSprite("door");
} }
} }

View File

@ -11,10 +11,7 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/ */
public class EmptyModel extends DisplayableElementModel { public class EmptyModel extends DisplayableElementModel {
EmptyModel() { EmptyModel() {
super(false, false, "black", super("black");
0, false, false,
false, null);
this.loadSprite("black"); this.loadSprite("black");
} }
} }