forked from deR0R0/sssnac-time
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnakePiece.java
More file actions
52 lines (42 loc) · 1.14 KB
/
SnakePiece.java
File metadata and controls
52 lines (42 loc) · 1.14 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
public abstract class SnakePiece extends Piece {
private int speed;
private String direction;
private SnakePiece leader;
private SnakePiece follower;
// constructor
public SnakePiece(int x, int y, int size, int speed, String direction, SnakePiece leader, SnakePiece follower) {
super(x, y, size);
this.speed = speed;
this.direction = direction;
this.leader = leader;
this.follower = follower;
}
// getter methods
public int getSpeed() {
return speed;
}
public String getDirection() {
return direction;
}
public SnakePiece getLeader() {
return leader;
}
public SnakePiece getFollower() {
return follower;
}
// setter methods
public void setSpeed(int speed) {
this.speed = speed;
}
public void setDirection(String direction) {
this.direction = direction;
}
public void setLeader(SnakePiece leader) {
this.leader = leader;
}
public void setFollower(SnakePiece follower) {
this.follower = follower;
}
// methods for moving
public abstract void move();
}