1b: inline static fields

This commit is contained in:
Daniel Langbein 2024-11-19 09:33:01 +01:00
parent 5ec9fa6e18
commit ab04dc1fd8
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
8 changed files with 32 additions and 209 deletions

View File

@ -10,30 +10,10 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class BoulderModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "boulder";
isDestructible = false;
canMove = true;
impactExplosive = false;
animate = true;
priority = 2;
collideSound = "die";
}
BoulderModel(boolean convertible) {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, false, collideSound, convertible);
this.loadSprite(spriteName);
super(false, true, "boulder",
2, false, true,
false, "die", convertible);
this.loadSprite("boulder");
}
}

View File

@ -10,32 +10,10 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class BrickWallModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "brickwall";
isDestructible = true;
canMove = false;
impactExplosive = false;
animate = false;
priority = 3;
falling = false;
collideSound = "touch";
}
BrickWallModel() {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
this.loadSprite(spriteName);
super(true, false, "brickwall",
3, false, false,
false, "touch");
this.loadSprite("brickwall");
}
}

View File

@ -10,33 +10,11 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-22
*/
public class CursorModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "cursor";
isDestructible = false;
canMove = false;
impactExplosive = false;
animate = false;
priority = 0;
falling = false;
collideSound = null;
}
CursorModel() {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
super(false, false, "cursor",
0, false, false,
false, null);
this.loadSprite(spriteName);
this.loadSprite("cursor");
}
}

View File

@ -10,36 +10,11 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class DirtModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "dirt";
isDestructible = true;
canMove = false;
impactExplosive = false;
animate = false;
priority = 0;
falling = false;
collideSound = null;
}
/**
* Class constructor
*/
DirtModel() {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
super(true, false,
"dirt", 0, false,
false, false, null);
this.loadSprite(spriteName);
this.loadSprite("dirt");
}
}

View File

@ -10,33 +10,11 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class DoorModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "door";
isDestructible = false;
canMove = false;
impactExplosive = false;
animate = false;
priority = 0;
falling = false;
collideSound = null;
}
DoorModel() {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
super(false, false, "door",
0, false, false,
false, null);
this.loadSprite(spriteName);
this.loadSprite("door");
}
}

View File

@ -10,33 +10,11 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class EmptyModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "black";
isDestructible = false;
canMove = false;
impactExplosive = false;
animate = false;
priority = 0;
falling = false;
collideSound = null;
}
EmptyModel() {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
super(false, false, "black",
0, false, false,
false, null);
this.loadSprite(spriteName);
this.loadSprite("black");
}
}

View File

@ -10,32 +10,10 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class ExpandingWallModel extends DisplayableElementModel {
private static String spriteName;
private static boolean destructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/*
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "expandingwall";
destructible = false;
canMove = false;
impactExplosive = false;
animate = false;
priority = 10;
falling = false;
collideSound = null;
}
ExpandingWallModel() {
super(destructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
this.loadSprite(spriteName);
super(false, false, "expandingwall",
10, false, false,
false, null);
this.loadSprite("expandingwall");
}
}

View File

@ -10,32 +10,10 @@ package fr.enssat.BoulderDash.models.displayableElement;
* @since 2015-06-19
*/
public class SteelWallModel extends DisplayableElementModel {
private static String spriteName;
private static boolean isDestructible;
private static boolean canMove;
private static boolean impactExplosive;
private static boolean animate;
private static int priority;
private static boolean falling;
private static String collideSound;
/**
* Static dataset
* Specifies the physical parameters of the object
*/
static {
spriteName = "steelwall";
isDestructible = false;
canMove = false;
impactExplosive = false;
animate = false;
priority = 3;
falling = false;
collideSound = "touch";
}
SteelWallModel() {
super(isDestructible, canMove, spriteName, priority, impactExplosive, animate, falling, collideSound);
this.loadSprite(spriteName);
super(false, false, "steelwall",
3, false, false,
false, "touch");
this.loadSprite("steelwall");
}
}