From 88649bd1819f739b9ea9579b68fbe73d00c2682d Mon Sep 17 00:00:00 2001 From: GammelJAN Date: Sat, 26 Sep 2020 11:29:25 +0200 Subject: [PATCH] radiant shit jesjes --- core/src/com/trs/game/StaticMath.java | 6 +++--- core/src/com/trs/game/model/Model.java | 6 +++--- core/src/com/trs/game/model/PermWall.java | 2 +- core/src/com/trs/game/model/Projectile.java | 2 +- core/src/com/trs/game/model/TempWall.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/com/trs/game/StaticMath.java b/core/src/com/trs/game/StaticMath.java index 5516c52..c4ac964 100644 --- a/core/src/com/trs/game/StaticMath.java +++ b/core/src/com/trs/game/StaticMath.java @@ -43,11 +43,11 @@ public class StaticMath { public static Polygon createPolygon(int xPos, int yPos, double angle, double width, double length){ float[] points = new float[8]; - double phi = (Math.PI / 2) - Math.toRadians(angle); + double phi = (Math.PI / 2) - angle; double d = Math.sin(phi) * width; double e = Math.cos(phi) * width; - double f = Math.sin(Math.toRadians(angle)) * length; - double g = Math.cos(Math.toRadians(angle)) * length; + double f = Math.sin(angle) * length; + double g = Math.cos(angle) * length; points[0] = xPos; points[1] = yPos; diff --git a/core/src/com/trs/game/model/Model.java b/core/src/com/trs/game/model/Model.java index 0fc5684..10fb556 100644 --- a/core/src/com/trs/game/model/Model.java +++ b/core/src/com/trs/game/model/Model.java @@ -44,13 +44,13 @@ public class Model { public void adjustWall(int x, int y){ if(drawing){ double angle = StaticMath.calculateAngle(x,y,(int)tempStart.x,(int)tempStart.y); - tempPolygon = StaticMath.createPolygon((int)tempStart.x, (int)tempStart.y, Math.toDegrees(angle-Math.PI),10,Vector2.dst(tempStart.x,tempStart.y,x,y)); + tempPolygon = StaticMath.createPolygon((int)tempStart.x, (int)tempStart.y, angle-Math.PI,10,Vector2.dst(tempStart.x,tempStart.y,x,y)); } } public void finishWall(int x, int y){ if(Vector2.dst(tempStart.x,tempStart.y,x,y) > 150) { double angle = StaticMath.calculateAngle(x,y,(int)tempStart.x,(int)tempStart.y); - tempPolygon = StaticMath.createPolygon((int)tempStart.x, (int)tempStart.y, Math.toDegrees(angle-Math.PI),10,Vector2.dst(tempStart.x,tempStart.y,x,y)); + tempPolygon = StaticMath.createPolygon((int)tempStart.x, (int)tempStart.y, angle-Math.PI,10,Vector2.dst(tempStart.x,tempStart.y,x,y)); boolean possible = true; if(Vector2.dst(tempStart.x,tempStart.y,x,y) > leftWallLength) @@ -71,7 +71,7 @@ public class Model { if(possible){ leftWallLength -= Vector2.dst(tempStart.x,tempStart.y,x,y); - walls.add(new TempWall(Math.toDegrees(angle-Math.PI), tempPolygon, 500)); + walls.add(new TempWall(angle-Math.PI, tempPolygon, 500)); } } tempPolygon = null; diff --git a/core/src/com/trs/game/model/PermWall.java b/core/src/com/trs/game/model/PermWall.java index 0a71ca8..a0c7ef3 100644 --- a/core/src/com/trs/game/model/PermWall.java +++ b/core/src/com/trs/game/model/PermWall.java @@ -23,7 +23,7 @@ public class PermWall implements Wall { public double getRotation() { float[] vertices = polygon.getVertices(); - return Math.toDegrees(StaticMath.calculateAngle((int) vertices[0], (int) vertices[1], (int) vertices[6], (int) vertices[7])); + return StaticMath.calculateAngle((int) vertices[0], (int) vertices[1], (int) vertices[6], (int) vertices[7]); } @Override diff --git a/core/src/com/trs/game/model/Projectile.java b/core/src/com/trs/game/model/Projectile.java index 1ddc079..5b8c399 100644 --- a/core/src/com/trs/game/model/Projectile.java +++ b/core/src/com/trs/game/model/Projectile.java @@ -72,7 +72,7 @@ public class Projectile { double alpha = Math.atan(movementY/movementX); double delta = (Math.PI / 2) - collisionAngle; double beta = +((Math.PI / 2) - alpha - delta); - double phi = beta + Math.toRadians(wall.getRotation()); + double phi = beta + wall.getRotation(); movementX = Math.cos(phi) * SPEED; movementY = Math.sin(phi) * SPEED; diff --git a/core/src/com/trs/game/model/TempWall.java b/core/src/com/trs/game/model/TempWall.java index 728b6ba..9995650 100644 --- a/core/src/com/trs/game/model/TempWall.java +++ b/core/src/com/trs/game/model/TempWall.java @@ -26,7 +26,7 @@ public class TempWall implements Wall { public double getRotation() { float[] vertices = polygon.getVertices(); - return Math.toDegrees(StaticMath.calculateAngle((int) vertices[0], (int) vertices[1], (int) vertices[6], (int) vertices[7])); + return StaticMath.calculateAngle((int) vertices[0], (int) vertices[1], (int) vertices[6], (int) vertices[7]); } @Override