This commit is contained in:
nora 2020-12-21 14:45:53 +01:00
parent 02aa5538f5
commit 81855c6a6d
11 changed files with 33 additions and 30 deletions

View file

@ -1,7 +1,7 @@
package objects.ships;
import core.general.Input;
import core.math.Coords;
import core.math.Coordinates;
import core.math.ExMath;
import core.math.Vector2D;
import core.objects.core.GameObject;
@ -44,13 +44,13 @@ public class Turret extends GameObject {
public void draw(Graphics2D g2d) {
g2d.setPaint(mainColor);
Vector2D abs = battleShip.getWorldCoordsFromLocal(position);
int sizeAbs = (int) Coords.getWorldCoords(size).x;
int sizeAbs = (int) Coordinates.getWorldCoordinates(size).x;
int xCenterAbs = (int) (abs.x + sizeAbs / 2);
int yCenterAbs = (int) (abs.y + sizeAbs / 2);
g2d.fillOval((int) abs.x, (int) abs.y, sizeAbs, sizeAbs);
g2d.setStroke(new BasicStroke((int) Coords.getWorldCoords(new Vector2D(size.x / barrelAmount / BARREL_THICKNESS, 0)).x, BasicStroke.CAP_BUTT,
g2d.setStroke(new BasicStroke((int) Coordinates.getWorldCoordinates(new Vector2D(size.x / barrelAmount / BARREL_THICKNESS, 0)).x, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_BEVEL));
//BARRELS---------------------------------------
@ -79,7 +79,7 @@ public class Turret extends GameObject {
public void update() {
Point msLoc = master.getMouseLocation();
Vector2D mouseRel = Coords.getMapCoordsFromWorld(Vector2D.fromPoint(msLoc)); //100 correct
Vector2D mouseRel = Coordinates.getMapCoordinatesFromWorld(Vector2D.fromPoint(msLoc)); //100 correct
Vector2D centerMap = battleShip.getMapCoords(getCenterPosition());
double targetRotation = -Math.atan2(centerMap.x - mouseRel.x, centerMap.y - mouseRel.y);