Skip to content
Snippets Groups Projects
Commit 05b46319 authored by Jan Einar Thorvaldsen's avatar Jan Einar Thorvaldsen
Browse files

Merge branch '57-fix-tank-flipping' into 'main'

#57 Fix tank flipping

Closes #57

See merge request !59
parents 3863ec68 2c1e4b5e
No related branches found
No related tags found
1 merge request!59#57 Fix tank flipping
Pipeline #215526 failed
......@@ -97,11 +97,8 @@ public class Tank {
shape.dispose();
updateCannonPos();
moveLeft();
if(directionLeft){
moveRight();
}
else{
moveLeft();
if(!directionLeft){
chassisSprite.flip(true, false);
}
}
......@@ -110,10 +107,6 @@ public class Tank {
Vector2 newPos = new Vector2(vertices[posInVertArr + 1]);
float angle = new Vector2(newPos.x - curPos.x, newPos.y - curPos.y).angleRad();
if(directionLeft){
chassisSprite.flip(true, false);
directionLeft = false;
}
if (chassis.getPosition().x <= TankWarsGame.GAMEPORT_WIDTH/TankWarsGame.SCALE - TANK_WIDTH && fuel > 0){
setPosition(newPos);
chassis.setTransform(newPos.x, newPos.y + 0.11f, angle);
......@@ -132,11 +125,6 @@ public class Tank {
Vector2 newPos = new Vector2(vertices[posInVertArr - 1]);
float angle = new Vector2(newPos.x - curPos.x, newPos.y - curPos.y).angleRad();
if(!directionLeft){
chassisSprite.flip(true, false);
directionLeft = true;
}
if (chassis.getPosition().x >= TANK_WIDTH && fuel > 0){
setPosition(newPos);
chassis.setTransform(newPos.x, newPos.y + 0.11f, angle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment