-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWood.pde
More file actions
41 lines (34 loc) · 722 Bytes
/
Wood.pde
File metadata and controls
41 lines (34 loc) · 722 Bytes
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
class Wood extends Box
{
Wood(float x, float y, float w, float h){
super(x, y, w, h);
}
boolean done() { return false; }
void onDisplay()
{
Vec2 pos = box2d.getBodyPixelCoord(m_body);
float a = m_body.getAngle();
pushMatrix();
pushStyle();
imageMode(CENTER);
translate(pos.x, pos.y);
rotate(-a);
if(m_w > m_h){
image(imgWoodH, 0, 0, m_w, m_h);
}else{
image(imgWoodV, 0, 0, m_w, m_h);
}
popStyle();
popMatrix();
}
FixtureDef getFixture()
{
// Define a fixture
FixtureDef fd = new FixtureDef();
// Parameters that affect physics
fd.density = 30;
fd.friction = 10.0;
fd.restitution = 0.0;
return fd;
}
}