T
- type of the sprite managed by this class.public class SpriteCollection<T extends Sprite>
extends java.util.ArrayList<T>
Constructor and Description |
---|
SpriteCollection() |
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics g,
java.awt.image.ImageObserver observer)
Draw all sprites in the collection.
|
boolean |
intersects(Sprite sp)
Checks whether any of the sprites in this collection intersects
with the given sprite.
|
void |
move()
Moves all sprites in the collection.
|
void |
removeIfInvisble()
Remove all invisible elements form the collection.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
public void draw(java.awt.Graphics g, java.awt.image.ImageObserver observer)
g
- the graphics contextobserver
- the image observerpublic boolean intersects(Sprite sp)
sp
- sprite to checktrue
if intersects, otherwise false
public void move()
public void removeIfInvisble()