Hello, I am making a small game and the borders are not working correctly.

```
void move() {
if (w) {
if (a) {
if (direction > 1 && direction <= 5) {
turn += .03;
}
else {
turn -= .03;
}
}
else if (d) {
if (direction > 3 && direction <= 7) {
turn += .03;
}
else {
turn -= .03;
}
}
else if (direction < 2 || direction > 6) {
turn -= .03;
}
else {
turn += .03;
}
acc.x = .3*cos(turn)*speedmod;
acc.y = .3*sin(turn)*speedmod;
}
if (a && !s && !w) {
if (direction <= 4 && direction > 0) {
turn += .03;
}
else {
turn -= .03;
}
acc.x = .3*cos(turn)*speedmod;
acc.y = .3*sin(turn)*speedmod;
}
if (s) {
if (a) {
if (direction >= 7 || direction <= 3) {
turn += .03;
}
else {
turn -= .03;
}
}
else if (d) {
if (direction >= 5 || direction <= 1) {
turn += .03;
}
else {
turn -= .03;
}
}
else if (direction > 6 || direction <= 2) {
turn += .03;
}
else {
turn -= .03;
}
acc.x = .3*cos(turn)*speedmod;
acc.y = .3*sin(turn)*speedmod;
}
if (d && !s && !w) {
if (direction > 4 && direction <= 8) {
turn += .03;
}
else {
turn -= .03;
}
acc.x = .3*cos(turn)*speedmod;
acc.y = .3*sin(turn)*speedmod;
}
if (turn > 2*PI) {turn = 0;}
if (turn < 0) {turn = 2*PI;}
speed.x += acc.x;
speed.y += acc.y;
pos.x += speed.x;
pos.y += speed.y;
speed.mult(.88);
tspeed = sqrt(speed.x*speed.x+speed.y*speed.y);
acc.x = 0;
acc.y = 0;
}
```

The movement is long but basically turns the player towards the direction you choose, and accelerates you based on where you are facing.

```
void checkBorders() {
if (pos.x > xtrans + 2*width/3) {xtrans += abs(2.9*speedmod);} //If the position of the tank goes past 2/3 of the screen, move the screen.
else if (pos.x < xtrans + width/3) {xtrans -= abs(2.9*speedmod);}
if (pos.y > ytrans + 2*height/3) {ytrans += abs(2.9*speedmod);}//If pos of tank is < 1/3 of the map, move screen.
else if (pos.y < ytrans + height/3) {ytrans -= abs(2.9*speedmod);}
//Below checks which quadrant the tank is facing.
direction = ceil(turn/(PI/4));
}
```

Here is where the issue comes up. The check borders function works, but the player slowly moves past the borders I set, even when I have the borders moving faster than the max speed of the player. Making it really fast just makes it jump forward.