-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathBlock.java
More file actions
42 lines (32 loc) · 743 Bytes
/
Copy pathBlock.java
File metadata and controls
42 lines (32 loc) · 743 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
42
import processing.core.*;
public class Block extends Simulatable implements ShapeRect, Drawable{
float width, height;
Block(float x, float y, float w, float h){
position.x = x;
position.y = y;
width = w;
height = h;
}
public float getMass(){
return 100f;
}
public float getKFactor(){
return 1f;
}
public float getWidth(){
return width;
}
public float getHeight(){
return height;
}
public boolean canCollide(Simulatable s){
return false;
}
public void draw(PApplet canvas, float scale){
canvas.fill(255,255,0);
canvas.stroke(0);
float x = (position.x - getWidth() / 2) * scale;
float y = (position.y - getHeight() / 2) * scale;
canvas.rect(x, y, getWidth() * scale, getHeight() * scale);
}
}