public double getAccelerationY(Particle p) { if ((p.getRecX() >= this.x) && (p.getRecX() <= (this.x + this.length)) && this.haveDone) { p.setRecY(2 * p.getY() - p.getRecY()); this.haveDone = false; } return 0; }
public double getAccelerationX(Particle p) { if ((p.getRecY() >= this.y) && (p.getRecY() <= (this.y + this.height)) && this.haveDone) { p.setRecX(2 * p.getX() - p.getRecX()); this.haveDone = false; } return 0; }