Collison with Circles
<p>I'm currently working on a Project where the user has to avoid Asteroids (drawn with ShapeRenderer) with a Spaceship(Sprite). The Asteroids are saved in a List Array. Now i'm trying to create a collision method when Sapceship and Asteroids collide. To make it as simple as possible i want to draw a Circle around the Spaceship and check for Collision. Eclipse says i have a I have a  <code>java.lang.IllegalStateException: begin must be called first</code>.</p>

<p>Asteroid Class:</p>

<pre><code>public Circle getBounds()
{
   return new Circle(p.x, p.y, radius);
}
</code></pre>

<p>Asteroids Class:</p>

<pre><code>public void update() 
{

    for (Asteroid a : asteroids) 
    {
        a.update(Gdx.graphics.getDeltaTime(), xMin, xMax, yMin, yMax);
    }

        for (int i = 0; i &lt; anzahl; i++) 
        {

          Asteroid a1 = asteroids.get(i);

           for (int j = i + 1; j &lt; anzahl; j++) 
           {

            Asteroid a2 = asteroids.get(j);

            float abstand = a1.abstand(a2);

            if (abstand &lt; a1.getRadius() + a2.getRadius()) 
            {

                berechneKollision(a1, a2);

            }

        }

    }

}


public void render(ShapeRenderer renderer) 
{

    for (Asteroid a : asteroids) 
    {
        renderer.setColor(1, 1, 0, 1);
        renderer.circle(a.getP().x, a.getP().y, a.getRadius());
    }
}
</code></pre>

<p>Spaceship Class:</p>

<pre><code> public Circle getBounds(){
    return new Circle(sprite.getX(), sprite.getY(), sprite.getWidth());
}
</code></pre>

<p>CollisionManager:</p>

<pre><code>    public class CollisionManager extends Asteroids {

       private Spaceship s = new Spaceship();

    public void checkCollisions(){
        for(int i = 0; i &lt; asteroids.size(); i++)
        {
            if(asteroids.get(i).getBounds().contains(s.getBounds()))                        
            {
            //asteroids.remove(asteroids);
            System.out.println("KOLLISION");
            }
        } 
    }

}
</code></pre>

<p>Screen:</p>

<pre><code>public abstract class Screen {

    public abstract void create();

    public abstract void render(SpriteBatch batch);

    public abstract void update();

    public abstract void update(ShapeRenderer renderer);

    public abstract void update(OrthoCamera cam);

    public abstract void resize(int width, int height);

    public abstract void render(ShapeRenderer renderer);

    public abstract void dispose(int width, int height);

    public abstract void dispose();

    public abstract void pause();

    public abstract void resume();

    public abstract void checkCollisions();
}
</code></pre>

<p>MenuScreen:</p>

<pre><code>public class MenuScreen extends Screen {

   private OrthoCamera cam;
   private Spaceship spaceship;
   private Asteroids asteroids;
   CollisionManager cm;

   .
   .
   .

    public void checkCollisions() 
    {
    cm.checkCollisions();
    }
</code></pre>

<p>Main Class:</p>

<pre><code> public class MyGdxGame implements ApplicationListener {


SpriteBatch batch;
ShapeRenderer renderer;
OrthoCamera cam;
public static int WIDTH = 1080 , HEIGHT = 720; // resolution

@Override
public void create() {
    batch = new SpriteBatch();
    renderer = new ShapeRenderer();
    ScreenManager.setScreen(new MenuScreen());

}
@Override
public void render() {

    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if(ScreenManager.getCurrentScreen() != null){
        ScreenManager.getCurrentScreen().checkCollisions();
        ScreenManager.getCurrentScreen().update();
        ScreenManager.getCurrentScreen().update(renderer);
        ScreenManager.getCurrentScreen().update(cam);

    }

    if(ScreenManager.getCurrentScreen() != null){
        ScreenManager.getCurrentScreen().render(batch);
        ScreenManager.getCurrentScreen().render(renderer);
    }
}
</code></pre>