mdh.hephaestus2.gamelib
Class SpriteGroup

java.lang.Object
  |
  +--mdh.hephaestus2.gamelib.SpriteGroup

public class SpriteGroup
extends Object

SpriteGroup organizes several sprites into a collection (internally, an ArrayList), and includes methods to detect collisions between groups.

Author:
Copyright © 2002 by Mark Hughes <kamikaze@kuoi.asui.uidaho.edu>

Constructor Summary
SpriteGroup(String name)
           
 
Method Summary
 void add(Sprite s)
          Adds a sprite to the group.
 HashMap collide(SpriteGroup other, boolean fast, boolean dokilla, boolean dokillb)
           
 boolean contains(Sprite s)
          Returns true if the group contains the sprite.
 void draw(Graphics2D g)
          Calls draw(g) on all sprites in the group.
 String getName()
           
 void remove(Sprite s)
          Removes the sprite from the group.
 int size()
          Returns the number of sprites contained in the group.
 Iterator sprites()
          Returns an iterator of the sprites in the group.
 void update()
          Calls update() on all sprites in the group.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpriteGroup

public SpriteGroup(String name)
Method Detail

add

public void add(Sprite s)
Adds a sprite to the group.


collide

public HashMap collide(SpriteGroup other,
                       boolean fast,
                       boolean dokilla,
                       boolean dokillb)

contains

public boolean contains(Sprite s)
Returns true if the group contains the sprite.


draw

public void draw(Graphics2D g)
Calls draw(g) on all sprites in the group.


getName

public String getName()

remove

public void remove(Sprite s)
Removes the sprite from the group.


size

public int size()
Returns the number of sprites contained in the group.


sprites

public Iterator sprites()
Returns an iterator of the sprites in the group.


update

public void update()
Calls update() on all sprites in the group.