-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiedras.pde
63 lines (56 loc) · 1.55 KB
/
Piedras.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
class Piedra
{
int posX;
int posY;
int radio;
boolean cayendo;
Piedra(int _posX, int _posY, int _radio)
{
posX = _posX;
posY = _posY;
radio = _radio;
cayendo = false;
}
void dibujar()
{
if ((cayendo) && frameCount % 50 == 0)
{
FCircle c = new FCircle(radio);
c.setPosition(random(305, 705), posY);
c.setName( "roca" + int(random(0, 4)) );
c.setDensity(200);
c.setVelocity(random(-500, 500), 0);
c.setRestitution(0.7);
c.setAngularVelocity(radians(int(random(-360, 360))));
mundo.add(c);
}
ArrayList<FBody> objetosMundo = mundo.getBodies();
for (int i = 0; i < objetosMundo.size(); i++)
{
FBody objetoi = objetosMundo.get(i);
if (objetoi.getName() != null && objetoi.getName().substring(0, min(objetoi.getName().length(), 4)).equals("roca"))
{
pushStyle();
fill(color(#c87e4d));
noStroke();
imageMode(CENTER);
if (lightSystem == 1)
{
blendMode(ADD);
image(aura, objetoi.getX(), objetoi.getY());
blendMode(BLEND);
}
pushMatrix();
translate(objetoi.getX(), objetoi.getY());
rotate(objetoi.getRotation());
image(roca[int(objetoi.getName().substring(min(objetoi.getName().length(), 4)))], 0, 0);
pushStyle();
tint(255, contadorCracksRocas.numero);
image(magmaRoca[int(objetoi.getName().substring(min(objetoi.getName().length(), 4)))], 0, 0);
popStyle();
popMatrix();
popStyle();
}
}
}
}