digrach

updatePartcles

Apr 3rd, 2014
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public void updateParticles() {
  2.         for (Particle p : particles) {
  3.             p.update();
  4.             // Check if the current particle's y does not yet exist as an index
  5.             // of the array
  6.             // and create a list of Particle at that index, if need be.
  7.             if (checkList[(int) p.getPosy()] == null) {
  8.                 checkList[(int) p.getPosy()] = new ArrayList<Particle>();
  9.             }
  10.             // Add the current particle to the array of lists at the index of y.
  11.             checkList[(int) p.getPosy()].add(p);
  12.             checkForColision(p);
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment