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
|
-
-
-
-
-
-
-
-
|
-
|
!
-
-
|
-
|
!
!
-
-
-
|
-
|
!
-
-
|
-
|
!
!
!
!
| #deffunc Collision
if (x+wid_x < px) { } else:if (px+wid_px < x) { } else:if (y+wid_y < py) { } else:if (py+wid_py < y) { } else { if (x < px) {
if (y < py) {
if ((x+wid_x) - px < (y+wid_y) - py) {
px = x + wid_x
}else{
py = y + wid_y
}
}else{
if ((x+wid_x) - px < (py+wid_py) - y) {
px = x + wid_x
}else{
py = y - wid_py
}
}
}else{
if (y < py) {
if ((px+wid_px) - x < (y+wid_y) - py) {
px = x - wid_px
}else{
py = y + wid_y
}
}else{
if ((px+wid_px) - x < (py+wid_py) - y) {
px = x - wid_px
}else{
py = y - wid_py
}
}
}
}
return
|