-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeep_processing.pde
More file actions
136 lines (101 loc) · 2.68 KB
/
Copy pathPeep_processing.pde
File metadata and controls
136 lines (101 loc) · 2.68 KB
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
import fisica.*;
import ddf.minim.*;
FWorld mundo;
Minim minim;
Camara camara;
Intro intro;
Mapa mapa;
Bird bird;
AudioPlayer musica;
int x = 0, y = 1;
float transX, transY;
PImage fondo;
//------------------------ DEFINIR EL TAMAÑO DE LA UNIDAD
float unidad = 40;
String escena = "intro";
boolean desarrollador = true;
boolean modoAsistido = true;
void setup() {
//P2D cambia el motor a OpenGL que es mas eficiente con graficos
size(1280, 720, P2D);
//frameRate(30);
smooth();
Fisica.init(this);
minim = new Minim(this);
mundo = new FWorld(-2000, -2000, 4000, 3000);
mundo.setGravity(0, 0);
camara = new Camara();
intro = new Intro();
bird = new Bird();
mapa = new Mapa();
musica = minim.loadFile(dataPath("sonidos") + "//" + "Hidden Temple.mp3", 2048);
musica.loop();
}
void draw() {
if (escena == "intro") {
intro.RunLoaderScreen();
}
if (escena == "menu") {
intro.RunMenu();
}
if (escena == "juego" || escena == "ganaste")
{
background(#b1adff);
image( fondo, -750-bird.getX(), -2000-bird.getY() );
pushMatrix();
transX = (width/2)-bird.getX();
transY = 400-bird.getY();
translate(transX, transY);
mundo.draw();
mundo.step();
bird.Update();
mapa.DibujarNiveles();
popMatrix();
if (desarrollador) {
camara.grilla.Update();
//println("frameRate " + frameRate);
}
if (escena == "ganaste") {
new PantallaDeVictoria();
bird.estado = "parado";
noLoop();
}
}//end escena==juego
}//end Draw
//--------------------------------------------
void contactStarted(FContact colision) {
FBody other = null;
if (colision.getBody1() == bird) {
other = colision.getBody2();
} else if (colision.getBody2() == bird) {
other = colision.getBody1();
}
if (other == null) {
return;//Si no hay colision, return.
}
if (other.getName() == "reset") {
bird.ColisionResetArea(other);
}
if (other.getName() == "areaDeVuelo") {
bird.ColisionAreaDeVuelo(other);
}
if (other.getName() == "areaNoElegida") {//Area interactiva
bird.ColisionAreaInteractivaDePlataformas(other);
}
if (other.getName() == "areaDeCaida") {
bird.ColisionAreaDeCaida(other);
}
if (other.getName() == "checkPoint") {
bird.ColisionCheckPoint(other);
}
if (other.getName() == "plataforma") {
bird.ColisionPlataforma(colision, other);
//println(other.getName() + frameCount);
}
if (other.getName() == "cambiarDireccion_derecha" || other.getName() == "cambiarDireccion_izquierda") {
bird.ColisionAreaCambiarDireccion(other);
}
//println(colision.getNormalY());
//println(other.getName());
//println(bird.estado);
}//end contactStarted