-
Notifications
You must be signed in to change notification settings - Fork 0
/
Init_Images_and_savePara.pde
153 lines (128 loc) · 3.78 KB
/
Init_Images_and_savePara.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
PImage Ibomb;
PImage Iwall;
PImage Idirt;
PImage Igrass;
PImage IexpHaut;
PImage IexpGauche;
PImage IexpCentre;
PImage IexpDroite;
PImage IexpBas;
PImage Iflame;
PImage Iinvincibility;
PImage Ideath;
PImage Ibombeup;
PImage Ivertical;
PImage Ihorizontal;
PImage IfeetBomb;
PImage Iheader;
PImage IenterMenu;
PImage IselectPerso;
PImage Iwin;
PImage Iperso1;
PImage Iperso2;
PFont overlay;
PFont win;
PFont menu;
SoundFile Sdeath;
SoundFile SpowerUp;
SoundFile SbombPos;
SoundFile Sexpl;
SoundFile Sclick;
SoundFile Music1;
SoundFile Music2;
SoundFile Music3;
SoundFile Music4;
SoundFile Music5;
SoundFile Music6;
SoundFile Music7;
SoundFile Music8;
ArrayList < SoundFile > Music = new ArrayList < SoundFile > ();
void initImg() {
Iwall = loadImage("blocdur.jpg");
Idirt = loadImage("blocmou.jpg");
Igrass = loadImage("blocGrass.jpg");
Ibomb = loadImage("Bomb1.jpg");
IexpHaut = loadImage("Haut.png");
IexpGauche = loadImage("Gauche.png");
IexpCentre = loadImage("ExplCentre.png");
IexpDroite = loadImage("Droite.png");
IexpBas = loadImage("Bas.png");
Ihorizontal = loadImage("Horizontal.png");
Ivertical = loadImage("Vertical.png");
Iflame = loadImage("FlameUp.jpg");
Iinvincibility = loadImage("Invincibility.jpg");
Ideath = loadImage("PowerFULL.jpg");
Ibombeup = loadImage("BombUp.jpg");
IfeetBomb = loadImage("FootBomb.jpg");
Iheader = loadImage("Header.png");
IenterMenu = loadImage("Menu.png");
IselectPerso = loadImage("SelectionPersonnageVide.png");
Iwin = loadImage("GameOver.png");
Iperso1 = loadImage("Perso.png");
Iperso2 = loadImage("Perso.png");
overlay = loadFont("SWIsop3-42.vlw");
win = loadFont("ProcessingSansPro-Semibold-25.vlw");
menu = loadFont("TrebuchetMS-48.vlw");
for (int k = 0; k < Music.size(); k++) {
Music.get(k).stop();
}
Music1 = null;
Music2 = null;
Music3 = null;
Music4 = null;
Music5 = null;
Music6 = null;
Music7 = null;
Music8 = null;
Sdeath = new SoundFile(this, "Death.wav");
SpowerUp = new SoundFile(this, "PowerUp.wav");
SbombPos = new SoundFile(this, "BombPos.wav");
Sexpl = new SoundFile(this, "Expl.wav");
Sclick = new SoundFile(this, "Click.wav");
Music1 = new SoundFile(this, "Music1.wav");
Music2 = new SoundFile(this, "Music2.wav");
Music3 = new SoundFile(this, "Music3.wav");
Music4 = new SoundFile(this, "Music4.wav");
Music5 = new SoundFile(this, "Music5.wav");
Music6 = new SoundFile(this, "Music6.wav");
Music7 = new SoundFile(this, "Music7.wav");
Music8 = new SoundFile(this, "Music8.wav");
Music.clear();
Music.add(Music1);
Music.add(Music2);
Music.add(Music3);
Music.add(Music4);
Music.add(Music5);
Music.add(Music6);
Music.add(Music7);
Music.add(Music8);
for (int k = 0; k < Music.size(); k++) {
Music.get(k).amp(0.1);
}
Sexpl.amp(0.3);
}
void savePara() {
para[0] = str(difficulty);
para[1] = str(sounds);
para[2] = str(music);
para[3] = str(showFPS);
para[4] = str(Player1.Color);
if (!IAPlaying) para[5] = str(Player2.Color);
para[6] = Player1.name;
if (!IAPlaying) para[7] = Player2.name;
para[8] = str(oPlayer1.input.TextLength);
if (!IAPlaying) para[9] = str(oPlayer2.input.TextLength);
para[10] = IPinput.Text;
para[11] = str(IPinput.TextLength);
String lines[] = loadStrings("Settings.txt");
for (int i = 0; i < lines.length; i++) {
if (para[i] != null) lines[i] = split(lines[i], '=')[0] + "=" + para[i];
}
saveStrings("/data/Settings.txt", lines);
}
boolean playing() {
for (int k = 0; k < Music.size(); k++) {
if (Music.get(k).isPlaying()) return true;
}
return false;
}