-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMove.java
More file actions
86 lines (83 loc) · 2.39 KB
/
Copy pathMove.java
File metadata and controls
86 lines (83 loc) · 2.39 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
import java.util.ArrayList;
public class Move {
public int speed;
public ArrayList<Point> path;
public Point start;
public Move(int speed, Point start) {
this.speed = speed;
this.start = start;
path = new ArrayList<Point>();
}
// 650. 800
public ArrayList<Point> createPath() {
path.add(start);
// Make up for any yards
if (start.y > 800) {
for(int n = (start.y - 800) / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y - speed));
}
}
// Go up
for (int n = 325 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y - speed));
}
// Go Right
for (int n = 360 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x + speed, last.y));
}
// Go Up
for (int n = 300 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y - speed));
}
// Go Left
for (int n = 130 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x - speed, last.y));
}
// Go Down
for (int n = 200 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y + speed));
}
// Go Left
for (int n = 555 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x - speed, last.y));
}
// Go Down
for (int n = 165 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y + speed));
}
// Go Right
for (int n = 195 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x + speed, last.y));
}
// Go Up
for (int n = 480 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y - speed));
}
// Go Right
for (int n = 180 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x + speed, last.y));
}
// Go Down
for (int n = 170 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x, last.y + speed));
}
// Go Left til end
for (int n = 555 / speed; n >= 0; n--) {
Point last = path.get(path.size() - 1);
path.add(new Point(last.x - speed, last.y));
}
return path;
}
}