I would like my alice to detect collision on mutiple Shroom classes. But I can;t get it right. Any help will be appreciated. Is there a way to detect collision for all the shrooms in 1 method?
public void checkCollisionShroom()
{
Actor collided = getOneIntersectingObject(Shroom.class);
if (collided !=null)
{
Greenfoot.playSound("ShroomPickup.wav");
((ShroomScore) getWorld().getObjects(ShroomScore.class).get(0)).add(1);
getWorld().removeObject(collided);
}
getOneIntersectingObject(shroom2.class);
if (collided !=null)
{
Greenfoot.playSound("ShroomPickup.wav");
((ShroomScore) getWorld().getObjects(ShroomScore.class).get(0)).add(1);
getWorld().removeObject(collided);
}
getOneIntersectingObject(shroom3.class);
if (collided !=null)
{
Greenfoot.playSound("ShroomPickup.wav");
((ShroomScore) getWorld().getObjects(ShroomScore.class).get(0)).add(1);
getWorld().removeObject(collided);
}
}

