radiant shit jesjes

master
GammelJAN 5 years ago
parent 94c91f54c4
commit 88649bd181

@ -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;

@ -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;

@ -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

@ -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;

@ -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

Loading…
Cancel
Save