Ejemplo n.º 1
0
 public void splash(double x, double strength, ParticleEmitter drops) {
   int index = indexOf(x);
   speeds[index] = strength * strength / 500;
   Util.repeat(
       (int) (strength * strength) / 2000,
       () -> {
         Vec2 dir = Vec2.fromPolar(Math.random(), Math.random() * Math.PI);
         drops.particles.add(
             new Particle(
                 new Vec2(x, heights[index]).add(dir), dir.multiply(50 * Math.sqrt(strength))));
       });
 }