Advertisement
Guest User

Untitled

a guest
Apr 21st, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. package javagame;
  2.  
  3. import java.util.ArrayList;
  4. import org.newdawn.slick.particles.ConfigurableEmitter;
  5. import org.newdawn.slick.particles.ParticleSystem;
  6.  
  7. public class ParticleManager {
  8.    
  9.     public ParticleSystem system;
  10.     public ConfigurableEmitter emitter;
  11.     ArrayList<Particle> particleList = new ArrayList<Particle>();
  12.     ArrayList<Particle> toRemove = new ArrayList<Particle>();
  13.    
  14.     String down="res/particles/bloodDown.xml";
  15.     String up="res/particles/bloodUp.xml";
  16.     String left="res/particles/bloodLeft.xml";
  17.     String right="res/particles/bloodRight.xml";
  18.    
  19.     public ParticleManager(){
  20.     }
  21.    
  22.     public void update(int delta){
  23.  
  24.         for (int i=0; i< particleList.size(); i++) {
  25.             if(particleList.get(i).emitter.completed() == true)
  26.                 particleList.remove(particleList.get(i));
  27.             else
  28.                 particleList.get(i).system.update(delta);
  29.         }
  30.     }
  31.    
  32.     public void bloodDown(float x, float y){
  33.        
  34.         Particle a= new Particle(down,x,y);
  35.         System.out.println("X: " + x + " Y : " + y);
  36.         particleList.add(a);
  37.        
  38.     }
  39.    
  40.     public void bloodUp(float x, float y){
  41.        
  42.         Particle a= new Particle(up,x,y);
  43.         particleList.add(a);
  44.        
  45.     }
  46.    
  47.     public void bloodLeft(float x, float y){
  48.        
  49.         Particle a= new Particle(left,x,y);
  50.         particleList.add(a);
  51.        
  52.     }
  53.    
  54.     public void bloodRight(float x, float y){
  55.        
  56.         Particle a= new Particle(right,x,y);
  57.         particleList.add(a);
  58.        
  59.     }
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement