-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainProyecto.pde
303 lines (250 loc) · 9 KB
/
MainProyecto.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
import processing.sound.*;
SoundFile Menú, juego, coin, colision, click;
int speed=10;
PImage piso;
PImage []escenario = new PImage [4]; // posibles escenarios
PImage menu[] = new PImage [5];
int xmenu = 0, ymenu = 0; // Posicion en x y de la imagen menú
boolean Escena0 = true, Escena1 = false, Manual = false, Creditos = false, Personajes=false, Escena_MultiOnly=false,Escenarios=false, Recovery=false;
boolean Creditos2=false;
boolean izquierda = false, derecha = false;
boolean confirmar_vida=false;
PImage botones[]= new PImage[3];
PImage personaje[]= new PImage[3];
String a= "";
String b= "";
String esc[]= new String[5]; // Textos de la pantalla escenario
int sz2=40;
int cl1=int(random(256)); // color r
int cl2=int(random(256)); // color g
int cl3=int(random(256)); // color b
PImage atras, adelante;
PImage credits, credits2;
PImage escprincipal; // Escenario principal
PImage manual;
PImage fondo_menu;
PImage fondo2;
PImage jugador1;
PImage jugador2;
PImage biblio;
PImage casa;
PImage bloque;
boolean MusicaPlaying= false, CoinPlaying=false, CoinRec=false, ColisionPlaying=false, ColisionRec=false;
PImage [] animacion = new PImage[9];
String jose, alexander, sergio;
ArrayList<PImage> pprincipal = new ArrayList<PImage>(); // PersonajesSeleccionados Principal
String name_to_score="TR";
int CantJugadores = 0;
int Seleccionados = 0;
Escena_Juego E1 = new Escena_Juego();
Score S_Scores;
void setup() {
size(1200, 600);
PFont mono;
mono = createFont("PoetsenOne-Regular.ttf", 38);
textFont(mono);
S_Scores =new Score();
iniciarMusicaMenu();
}
void draw() {
if (Escena0) { // Si está en el menú
if (!MusicaPlaying) {
iniciarMusicaMenu();
}
background(0,0,0);
Escena_Menu();
} else if (Escena1) {
detenerMusicaMenu();
iniciarMusicaJuego();
PFont mono;
mono = createFont("PoetsenOne-Regular.ttf", 38);
textFont(mono);
E1.draw();
if(CoinRec){
CoinRecogida();
CoinRec=false;
}
if(ColisionRec){
ColisionSonido();
ColisionRec=false;
}
} else if (Escenarios) {
Elegir_Escenario();
} else if (Personajes) { // Si está en la seleccion del personaje
Escena_Personajes(Seleccionados);
} else if (Manual) { // Si se muestra el manual
Escena_Manual();
} else if (Creditos) { // Se muestran los creditos
Escena_Creditos();
}else if (Creditos2) { // Se muestran los creditos
Escena_Creditos2();
}else if (Escena_MultiOnly){
background(255,255,255);
pregunta();
}
}
void mousePressed() {
println("X ES:", mouseX);
println("Y ES:", mouseY);
if (Escena0) { // Si está en la escena del menú
if (mouseX > 0 && mouseX < 400 && mouseY > 0 && mouseY < 100) {
Escena0 = false;
Escenarios = true;
click();
} else if (mouseX > 400 & mouseX < 800 && mouseY > 0 & mouseY < 100) {
Escena0 = false;
Manual = true;
click();
} else if (mouseX > 800 && mouseX < 1200 & mouseY > 0 && mouseY < 100) {
Escena0 = false;
Creditos = true;
click();
}
}else if (Escenarios) { // SI ESTOY EN EL MENU ESCENARIOS
if (mouseX>1094 & mouseX<1157 & mouseY>10 & mouseY<61) { // VOY ATRAS
Escenarios= false;
Escena0=true;
click();
}else if (mouseX>97 & mouseX<437 & mouseY>98 & mouseY<291) { // Escenario biblioteca
Escenarios= false;
Escena_MultiOnly=true;
//Personajes=true;
escprincipal= escenario[1];
click();
}else if (mouseX>454 & mouseX<798 & mouseY>299 & mouseY<497) { // Escenario Casa estudio
Escena_MultiOnly=true;
Escenarios= false;
//Personajes=true;
escprincipal= escenario[2];
click();
}else if (mouseX>800 & mouseX<1147 & mouseY>98 & mouseY<297) { // Escenario Bloque J
Escenarios= false;
Escena_MultiOnly=true;
//Personajes=true;
escprincipal= escenario[3];
click();
}
}else if (Personajes) { // SI ESTOY SELECCIONANDO PERSONAJES
if (mouseX>34 & mouseX<124 & mouseY>50 & mouseY<290) { // SELECCIONAR PERSONAJE DE JOSE
if(CantJugadores==1){
name_to_score="Jose";
}
pprincipal.add(personaje[0]);
Seleccionados +=1;
click();
} else if (mouseX>420 & mouseX<519 & mouseY>50 & mouseY<290) { // SELECCIONAR PERSONAJE DE ALEXANDER
if(CantJugadores==1){
name_to_score="Alexander";
}
pprincipal.add(personaje[1]);
Seleccionados +=1;
click();
} else if (mouseX>806 & mouseX<918 & mouseY>50 & mouseY<290) { // SELECCIONAR PERSONAJE DE SERGIO
if(CantJugadores==1){
name_to_score="Sergio";
}
pprincipal.add(personaje[2]);
Seleccionados +=1;
click();
} else if (mouseX>1094 & mouseX<1157 & mouseY>10 & mouseY<61) { // VOY ATRAS
Personajes= false;
Escena_MultiOnly=true;
click();
}
if (Seleccionados == CantJugadores) {
Personajes= false;
Escena1=true;
E1.setEscenario(escprincipal);
E1.setPersonaje(pprincipal);
}
}else if (Creditos) {
if (mouseX>1094 & mouseX<1157 & mouseY>10 & mouseY<61) { // VOY ATRAS
Creditos= false;
Escena0=true;
click();
} else if (mouseX>120 & mouseX<578 & mouseY>158 & mouseY<219) {
link("https://www.alamy.es/puente-de-diversos-derechos-hombre-gente-saltando-stick-figura-stickman-pictograma-iconos-image214760025.html");
} else if (mouseX>118 & mouseX<303 & mouseY>272 & mouseY<293) {
link("https://co.pinterest.com/pin/431501208058226263/");
} else if (mouseX>120 & mouseX<628 & mouseY>328 & mouseY<365) {
link("https://www.shutterstock.com/es/image-vector/stickman-icon-stick-figure-man-person-2311274885");
} else if (mouseX>118 & mouseX<621 & mouseY>423 & mouseY<469) {
link("https://www.elparquedelosdibujos.com/dibujos/dibujos-de-animales/dibujos-de-gatos/dibujos-de-gatos.php");
} else if (mouseX>114 & mouseX<626 & mouseY>516 & mouseY<542) {
link("https://www.istockphoto.com/es/ilustraciones/iguana");
} else if (mouseX>831 & mouseX<1024 & mouseY>310 & mouseY<368) {
link("https://hoopgame.net/play/Sonic-the-Hedgehog");
} else if (mouseX>715 & mouseX<1109 & mouseY>431 & mouseY<545) {
link("https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.freepik.es%2Ffotos-vectores-gratis%2Fpergamino&psig=AOvVaw1AkY8kXMf75bUwEn9a50jh&ust=1713975048870000&source=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCIiJ_ePc2IUDFQAAAAAdAAAAABAE");
} else if (mouseX>38 & mouseX<93 & mouseY>26 & mouseY<75) { // VOY A LOS CREDITOS 2
Creditos= false;
Creditos2=true;
click();
}
}else if(Creditos2){
if (mouseX>1094 & mouseX<1157 & mouseY>10 & mouseY<61) { // VOY ATRAS
Creditos2= false;
Creditos=true;
click();
} else if (mouseX>164 & mouseX<655 & mouseY>158 & mouseY<173) {
link("https://www.youtube.com/watch?v=YV2MhItwEk8");
} else if (mouseX>167 & mouseX<657 & mouseY>229 & mouseY<247) {
link("https://www.youtube.com/watch?v=sj8Ar0o4Z7k");
} else if (mouseX>166 & mouseX<655 & mouseY>301 & mouseY<318) {
link("https://www.youtube.com/watch?v=3t4MduIPW_0");
} else if (mouseX>166 & mouseX<655 & mouseY>375 & mouseY<392) {
link("https://www.youtube.com/watch?v=1FpStbIrcUE");
} else if (mouseX>166 & mouseX<655 & mouseY>446 & mouseY<461) {
link("https://www.youtube.com/watch?v=do5DHs9VGSw");
} else if (mouseX>811 & mouseX<1114 & mouseY>177 & mouseY<217) {
link("https://www.pngwing.com/es/free-png-maupq");
}
}else if(Manual){
if (mouseX>1094 & mouseX<1157 & mouseY>10 & mouseY<61) { // VOY ATRAS
Manual=false;
Escena0=true;
click();
}
}else if(Escena_MultiOnly){ ////////////////////////////////////////////////////////////SI ESTOY SELECCIONANDO 1 O 2 JUGADORES
if (mouseX>401 & mouseX<798 & mouseY>137 & mouseY<229) { //////////// 1 JUGADOR
Escena_MultiOnly= false;
Personajes=true;
CantJugadores=1;
click();
} else if (mouseX>400 & mouseX<800 & mouseY>298 & mouseY<400) { /////// 2 JUGADORES
Escena_MultiOnly = false;
Personajes=true;
CantJugadores=2;
click();
} else if (mouseX>1094 & mouseX<1157 & mouseY>10 & mouseY<61) { // VOY ATRAS
Escena_MultiOnly= false;
Escenarios=true;
click();
}
}
}
void keyPressed() {
if (Escena1) {
E1.keyPressed();
}
if (Recovery == true ){
if(keyCode == 'K' || keyCode == 'k'){
exit();
}
if(keyCode == 'R' || keyCode == 'r'){
background(0,0,0);
E1 = new Escena_Juego();
E1.setEscenario(escprincipal);
E1.setPersonaje(pprincipal);
Recovery = false;
Escena1=true;
}
}
}
void keyReleased() {
if (Escena1) {
if (Escena1) {
E1.keyReleased();
}
}
}