java Point type subtraction -
i'm trying implement subtraction method
problem when try use it give me error here's code
public point subtract( point p1, point p2) { point p3 = new point(); p3 = p1 - p2; ////getting error here return p3; } public int ishorizonatalcollision(objects object) { int tru = 0; int leftcolli = 1; point eqp; eqp = subtract(posi(), nposi()); if (eqp == objposi(object) ) { return leftcolli; } return tru; }
public static point subtract(point p1, point p2) { return new point(p1.x - p2.x, p1.y - p2.y); }
or
public static point subtract(point p1, point p2) { return new point(p1.getx() - p2.getx(), p1.gety() - p2.gety()); }
Comments
Post a Comment