-
Notifications
You must be signed in to change notification settings - Fork 0
/
RoadBlock.pde
40 lines (31 loc) · 840 Bytes
/
RoadBlock.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
public class RoadBlock implements IDisplayable, IPoolable{
PImage texture;
PVector position;
PVector size;
public RoadBlock(){
texture = loadImage("road.png");
}
public RoadBlock(PImage texture, PVector position, PVector size){
this.size = size;
this.position = position;
this.texture = texture;
}
public void display(){
image(texture, position.x, position.y, size.x, size.y);
}
public void updatePosition(float currentSpeed){
this.position.y += currentSpeed/frameRate;
}
public PVector getSize(){
return this.size;
}
public PVector getPosition(){
return this.position;
}
public void setSize(PVector size){
this.size = size;
}
public void setPosition(PVector pos){
this.position = pos;
}
}