Skip to content

Commit 23e72dd

Browse files
committed
Cleaned assetNames
1 parent fad7860 commit 23e72dd

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

duelinvaders/src/main/java/org/enstabretagne/Utils/assetNames.java

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
/**
88
* Classe contenant les noms des assets du jeu
9-
* Cela permet d'éviter les risques de fautes de frappe et centralise l'ensemble des noms d'assets du jeu
9+
* Cela permet d'éviter les risques de fautes de frappe et centralise l'ensemble
10+
* des noms d'assets du jeu
1011
*
1112
* @author LBF38, MathieuDFS, jufch
1213
* @since 0.2.0
@@ -22,18 +23,20 @@ public static class textures {
2223
public static final String BACKGROUND = "background.png";
2324
public static final String EXPLOSION_PLAYER = "explosion_player.png";
2425
public static final String EXPLOSION_FINAL = "explosion_final.png";
25-
public static final ArrayList<String> EXPLOSIONS = new ArrayList<String>();
26-
static {
27-
for (int i = 1; i <= Constant.NUMBER_OF_EXPLOSIONS; i++) {
28-
EXPLOSIONS.add("explosion" + i + ".png");
26+
public static final ArrayList<String> EXPLOSIONS = new ArrayList<String>() {
27+
{
28+
for (int i = 1; i <= Constant.NUMBER_OF_EXPLOSIONS; i++) {
29+
add("explosion" + i + ".png");
30+
}
2931
}
30-
}
31-
public static final ArrayList<String> LIFES = new ArrayList<String>();
32-
static {
33-
for (int i = 1; i <= 3; i++) {
34-
LIFES.add("life" + i + ".png");
32+
};
33+
public static final ArrayList<String> LIFES = new ArrayList<String>() {
34+
{
35+
for (int i = 1; i <= 3; i++) {
36+
add("life" + i + ".png");
37+
}
3538
}
36-
}
39+
};
3740
public static final String FIRE = "fire.png";
3841
public static final String SMOKE = "smoke.png";
3942
}
@@ -54,18 +57,20 @@ public static class sounds {
5457
public static final String START_CLAIRON = "autre/claironStart.wav";
5558
public static final String DEFEAT_CLAIRON = "autre/claironDefeat.wav";
5659
public static final String VICTORY_CLAIRON = "autre/claironVictory.wav";
57-
public static final ArrayList<String> AMBIENT_SOUNDS = new ArrayList<String>();
58-
static {
59-
for (int i = 1; i < Constant.NUMBER_OF_AMBIENT_SOUND + 1; i++) {
60-
AMBIENT_SOUNDS.add("ambiance/ambientSound" + i + ".wav");
60+
public static final ArrayList<String> AMBIENT_SOUNDS = new ArrayList<String>() {
61+
{
62+
for (int i = 1; i < Constant.NUMBER_OF_AMBIENT_SOUND + 1; i++) {
63+
add("ambiance/ambientSound" + i + ".wav");
64+
}
6165
}
62-
}
66+
};
6367
public static final String CANNON_SHOT = "Tir/canon.wav";
64-
public static final ArrayList<String> LASER_SOUNDS = new ArrayList<>();
65-
static {
66-
for (int i = 1; i <= Constant.NUMBER_OF_LASER_SOUNDS; i++) {
67-
LASER_SOUNDS.add("Tir/laser" + i + ".wav");
68+
public static final ArrayList<String> LASER_SOUNDS = new ArrayList<>() {
69+
{
70+
for (int i = 1; i <= Constant.NUMBER_OF_LASER_SOUNDS; i++) {
71+
add("Tir/laser" + i + ".wav");
72+
}
6873
}
69-
}
74+
};
7075
}
7176
}

0 commit comments

Comments
 (0)