Original Post
I'm trying to create Asteroids but I'm having trouble with the collisions. Right now I have: GetShape returns a polygon that has all of the x and y points. asteroids is a vector of the Asteroid objects. Right now, just to see if it was working I have it removing the asteroid when the ship runs into it, but it does not work. Thanks for any help. [Edited by - lkdizzlel7 on April 19, 2007 5:08:55 PM]
for(int loop=0;loop<asteroids.size();loop++)
{
for(int loop2=0;loop2<asteroids.get(loop).getShape().npoints;loop2++)
{
if(ship.getShape().contains(asteroids.get(loop).getShape().xpoints[loop2], asteroids.get(loop).getShape().ypoints[loop2]))
{
asteroids.remove(loop);
}
}
for (int loop2=0;loop2<ship.getShape().npoints;loop2++)
{
if (asteroids.get(loop).getShape().contains(ship.getShape().xpoints[loop2], ship.getShape().ypoints[loop2]))
{
asteroids.remove(loop);
}
}
}