public void emit() { for (int i = 1; i <= emitNum; i++) { Particle x = new Particle(loc.x, loc.y, 0, null); if (images != null) { x.setImage(images[(int) randomP(images.length)]); } else { x.setImage(null); } double temp = angle2 - angle1; double newAngle = (((rnd.nextDouble() * temp) + angle1) * Math.PI / 180); if (randomV) { x.setVel( randomP(xSpeed) * FastMath.cos(newAngle), randomP(ySpeed) * FastMath.sin(newAngle), 0); } else { x.setVel(xSpeed * FastMath.cos(newAngle), ySpeed * FastMath.sin(newAngle), 0); } x.setFade(fade); x.setFadeRate(fadeRate); x.setLoc(loc.x + random(spreadX), loc.y + random(spreadY), 0); x.setAcc(xAcc, yAcc, 0); x.setMaxAge(maxAge); x.setMaxSize(maxSize); x.setSize(size); x.setAgeRate(ageRate); x.setGrowthRate(growthRate); x.setBlink(blink); x.setColor(color); x.setMaxSpeed(new Vector3D(maxXSpeed, maxYSpeed, 0)); particleManager.addParticle(x); } }