Advertisement
Guest User

Untitled

a guest
May 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. package ethex.particle;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. public class ParticleGenerator
  7. {
  8. public static int amount;
  9. public static int width;
  10. public static int height;
  11. public ArrayList<Particle> particles = new ArrayList();
  12. private Random random = new Random();
  13.  
  14. public ParticleGenerator(int amount, int width, int height)
  15. {
  16. this.amount = amount;
  17. this.width = width;
  18. this.height = height;
  19. for (int i = 0; i < amount; i++) {
  20. this.particles.add(new Particle(this.random.nextInt(width), this.random.nextInt(height)));
  21. }
  22. }
  23.  
  24. public void drawParticles()
  25. {
  26. for (Particle p : this.particles) {
  27. p.draw();
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement