Update StrategySystem.cpp
This commit is contained in:
1 parent
361cd1aaec
commit
b9f253ccd9
1 file changed
+12
-1
+12
-1
@@ -2401,9 +2401,14 @@ int CStrategySystem::search2() // 查找在小区里的机器人
|
||||
}
|
||||
|
||||
// 守门
|
||||
void CStrategySystem::Goalie() {
|
||||
void CStrategySystem::Goalie() { // TODO 两侧卡顿
|
||||
static int xit;
|
||||
if (start)
|
||||
ball.oldPosition = ball.position;
|
||||
if (ball.position != ball.oldPosition)
|
||||
xit = 0;
|
||||
else
|
||||
xit++;
|
||||
if (ball.position.x <= hgoalie.position.x) {
|
||||
int xix = ball.position.x > 950 ? 965 : 950, xiy, xii = int((double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * 965 + (ball.oldPosition.y - (double(ball.position.y - ball.oldPosition.y) / (ball.position.x - ball.oldPosition.x)) * ball.oldPosition.x) + 0.5), xid = 2;
|
||||
if (Distance(ball.position, ball.oldPosition) < 1 || ball.position.x <= ball.oldPosition.x || xii < 313 || xii > 505) {
|
||||
@@ -2435,6 +2440,12 @@ void CStrategySystem::Goalie() {
|
||||
}
|
||||
if (xiy <= 313 || xiy >= 505)
|
||||
xix = 965;
|
||||
// if (ball.position.x >= 900 && ball.position.y >= 313 && ball.position.y <= 505 && xit >= 10) // TODO 旋球
|
||||
// if (shooter_pos().y > ball.position.y)
|
||||
// Direction(HGOALIE, CPoint(ball.position.x + 1, ball.position.y + 1));
|
||||
// else
|
||||
// Direction(HGOALIE, CPoint(ball.position.x + 1, ball.position.y - 1));
|
||||
// else
|
||||
Direction(HGOALIE, CPoint(xix, xiy));
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user