Part III

 
Background knowledge
Animation
Can I have more balls?
Object revisited
Particle

Particle or particle system is similar to a group of balls. In most case, we would like to adopt a life metaphor and give a life span for each particle. It appears upon some interactions and disappears when it exceeds its life span.
ArrayList balls = new ArrayList();
balls.add(new Ball(width/2, height/2)); 
int i = ?;
balls.remove(i); 
balls.clear();
Ball b = (Ball) balls.get(i); 
int cnt = balls.size(); 

 

ArrayList implementation
Giving life to the balls
Remove inactive balls
A complete example
Variations
More professional
The force
Varying forces
Application