1b: add constructor with 3 params

This commit is contained in:
Daniel Langbein 2024-11-19 11:28:47 +01:00
parent 7d3f773365
commit 7a9956fb63
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
9 changed files with 44 additions and 36 deletions

View File

@ -11,9 +11,12 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/
public class BoulderModel extends DisplayableElementModel {
BoulderModel(boolean convertible) {
super(false, true, "boulder",
2, false, true,
false, "die", convertible);
this.loadSprite("boulder");
super("boulder", false,true);
setPriority(2);
setAnimate(true);
setCollideSound("die");
setConvertibleValue(convertible);
loadSprite("boulder");
}
}

View File

@ -11,9 +11,10 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/
public class BrickWallModel extends DisplayableElementModel {
BrickWallModel() {
super(true, false, "brickwall",
3, false, false,
false, "touch");
this.loadSprite("brickwall");
super("brickwall", true, false);
setPriority(3);
setCollideSound("touch");
loadSprite("brickwall");
}
}

View File

@ -23,9 +23,9 @@ public class DiamondModel extends DisplayableElementModel {
private ArrayList<BufferedImage> framesDiamond;
DiamondModel() {
super(true, true, "diamond",
0, false, true,
false, "coin");
super("diamond", true, true);
setAnimate(true);
setCollideSound("coin");
this.initSprites();
}

View File

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

View File

@ -52,20 +52,22 @@ public abstract class DisplayableElementModel {
this.collideSound = collideSound;
}
public DisplayableElementModel(boolean destructible, boolean moving, String spriteName, int priority, boolean impactExplosive, boolean animate, boolean falling, String collideSound) {
this(
destructible, moving, spriteName,
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
);
falling, collideSound, false);
}
public DisplayableElementModel(final String spriteName){
this(
false, false, spriteName,
public DisplayableElementModel(final String spriteName, boolean destructible, boolean moving){
this(destructible, moving, spriteName,
0, false, false,
false, null
);
false, null);
}
public DisplayableElementModel(final String spriteName){
this(spriteName, false, false);
}
public static BoulderModel newBoulderModel(boolean convertible) {

View File

@ -11,9 +11,9 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/
public class ExpandingWallModel extends DisplayableElementModel {
ExpandingWallModel() {
super(false, false, "expandingwall",
10, false, false,
false, null);
super("expandingwall");
setPriority(10);
this.loadSprite("expandingwall");
}
}

View File

@ -24,9 +24,10 @@ public class MagicWallModel extends DisplayableElementModel {
private long speed;
MagicWallModel() {
super(false, false, "magicwall",
3, false, false,
false, "touch");
super("magicwall");
setPriority(3);
setCollideSound("touch");
this.currentFrame = 0;
this.speed = 100;
this.initSprites();

View File

@ -47,9 +47,11 @@ public class RockfordModel extends DisplayableElementModel {
private boolean hasExploded;
RockfordModel() {
super(true, true, "rockford",
1, true, true,
false, null);
super("rockford", true, true);
setPriority(1);
setImpactExplosive(true);
setAnimate(true);
// Speed of the animation of the sprite
this.setSpeed(100);
// Init the sprites in arrays

View File

@ -11,9 +11,10 @@ package fr.enssat.BoulderDash.models.displayableElement;
*/
public class SteelWallModel extends DisplayableElementModel {
SteelWallModel() {
super(false, false, "steelwall",
3, false, false,
false, "touch");
super("steelwall");
setPriority(3);
setCollideSound("touch");
this.loadSprite("steelwall");
}
}