-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhat.java
122 lines (112 loc) · 1.62 KB
/
hat.java
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import javax.swing.ImageIcon;
public class hat {
private ImageIcon hat1, hat2, hat3;
private int xPos1, yPos1, xPos2, yPos2, xPos3, yPos3;
private int dir1, dir2, dir3;
public hat()
{
hat1 = new ImageIcon("src/sortingHat.png");
hat2 = new ImageIcon("src/sortingHat.png");
hat3 = new ImageIcon("src/sortingHat.png");
xPos1 = 525;
yPos1 = 560;
xPos2 = 150;
yPos2 = 480;
xPos3 = 525;
yPos3 = 380;
dir1 = 1;
dir2 = 1;
dir3 = 1;
}
public ImageIcon getHat1()
{
return hat1;
}
public ImageIcon getHat2()
{
return hat2;
}
public ImageIcon getHat3()
{
return hat3;
}
public int getX1()
{
return xPos1;
}
public int getY1()
{
return yPos1;
}
public int getX2()
{
return xPos2;
}
public int getY2()
{
return yPos2;
}
public int getX3()
{
return xPos3;
}
public int getY3()
{
return yPos3;
}
public void move(int dir1, int dir2, int dir3)
{
if (dir1 == 1)
{
xPos1 -= 40;
}
else if (dir1 == -1)
{
xPos1 += 40;
}
if (dir2 == -1)
{
xPos2 -= 10;
}
else if (dir2 == 1)
{
xPos2 += 10;
}
if (dir3 == 1)
{
xPos3 -= 20;
}
else if (dir3 == -1)
{
xPos3 += 20;
}
}
public void setDir(int direction)
{
dir1 = direction;
}
public void setX1(int x1)
{
xPos1 = x1;
}
public void setY1(int y1)
{
yPos1 = y1;
}
public void setX2(int x2)
{
xPos2 = x2;
}
public void setY2(int y2)
{
yPos2 = y2;
}
public void setX3(int x3)
{
xPos3 = x3;
}
public void setY3(int y3)
{
yPos3 = y3;
}
}