fix halfellipsemover so it doesnt get stuck

This commit is contained in:
yugecin 2016-09-30 10:04:47 +02:00
parent e082adb37f
commit 6965e33856

View File

@ -30,8 +30,8 @@ public class HalfEllipseMover extends Mover {
public HalfEllipseMover(GameObject start, GameObject end, int dir) { public HalfEllipseMover(GameObject start, GameObject end, int dir) {
super(start, end, dir); super(start, end, dir);
middlex = (startX - endX) / 2d; middlex = (startX + endX) / 2d;
middley = (startY - endY) / 2d; middley = (startY + endY) / 2d;
radius = Utils.distance(middlex, middley, startX, startY); radius = Utils.distance(middlex, middley, startX, startY);
ang = Math.atan2(startY - middley, startX - middlex); ang = Math.atan2(startY - middley, startX - middlex);
mod = 2d; mod = 2d;
@ -44,8 +44,8 @@ public class HalfEllipseMover extends Mover {
@Override @Override
public double[] getPointAt(int time) { public double[] getPointAt(int time) {
double Tangle = Math.PI * getT(time) * dir; double Tangle = Math.PI * getT(time) * dir;
double x = middlex + Math.cos(Tangle) * radius; double x = middlex + Math.cos(Tangle) * radius * mod; // TODO fix this
double y = middley + Math.sin(Tangle) * radius; double y = middley + Math.sin(Tangle) * radius * mod;
double dx = middlex - x; double dx = middlex - x;
double dy = middley - y; double dy = middley - y;