-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathD4_Bacteria.pde
More file actions
98 lines (73 loc) · 1.59 KB
/
Copy pathD4_Bacteria.pde
File metadata and controls
98 lines (73 loc) · 1.59 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
public class Bacteria
{
private PImage image1;
private PImage image2;
private int capa;
private float x;
private float y;
private float rotacion;
private float scale;
private boolean imagen;
public Bacteria(PImage image1, PImage image2, int capa, float x, float y, float rotacion, float scale)
{
super();
this.image1 = image1;
this.image2 = image2;
this.capa = capa;
this.x = x;
this.y = y;
this.rotacion = rotacion;
this.scale = scale;
}
public void update()
{
if( frameCount % (int)(30 * scale) == 0 )
{
imagen = !imagen;
}
}
/*public void draw()
{
pushStyle();
imageMode(PConstants.CENTER);
pushMatrix();
translate(mouseX, mouseY);
scale(scaleBac);
rotate(rotacionBac);
image(bacteria1, 0, 0);
popMatrix();
popStyle();*
}*/
public PImage getImage() {
return image1;
}
public int getCapa() {
return capa;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public float getRotacion() {
return rotacion;
}
public float getScale() {
return scale;
}
public void draw( PGraphics pg, float x, float y )
{
pg.pushStyle();
pg.imageMode(PConstants.CENTER);
pg.pushMatrix();
pg.translate(x, y);
pg.scale(scale);
pg.rotate(rotacion);
pg.image(imagen ? image1 : image2, 0, 0);
pg.fill(0);
pg.text(capa, 0, 0);
pg.popMatrix();
pg.popStyle();
}
}