
class PixelSpriteComposite extends PixelSprite {
  private PixelSpriteList sprites;

  public PixelSpriteComposite() {
    this.sprites = new PixelSpriteList();
  }

  public void addSprite( PixelSprite sprite, int layer ) {
    sprites.add( sprite, layer );

    sprite.setParent( this );
  }

  public boolean removeSprite( PixelSprite sprite ) {
    if ( sprites.remove( sprite ) ) {
      sprite.setParent( null );

      return true;
    } else
      return false;
  }

  public void renderHook( PixelPanel panel, double parentX, double parentY ) {
    sprites.render( panel, parentX + x, parentY + y );
  }
}
