public void update(int ms) { float x = particle.getX(); float y = particle.getY(); Vector f = new Vector(0f, -0.001f, 0f); float l = 50, r = 750; float t = 550, b = 50; if (x < l) f.x += 0.002f; else if (x > r) f.x -= 0.002f; if (y < b) f.y += 0.002f; else if (y > t) f.y -= 0.002f; particle.applyForce(f); particle.integrate(ms); particle.clearForces(); }