예제 #1
0
  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;
  }
예제 #2
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;
  }