how would i do this? do i put destroyer.shipTouching, cruiser.shipTouching, etc. in the smaller while loops inside the main while loop as well?
for (Ship ship : < list or array of ships >) // for each ship to be added
{
addObject(ship, 0, 0); // add ship into world
int size = (ship.getImage().getWidth()+50)/60; // get size of ship (number of 'hp')
while (true)
{
// get random coordinates for top/left-most spot this actor is to take
int x = Greenfoot.getRandomNumber(10);
int y = Greenfoot.getRandomNumber(10);
ship.setLocation(30+60*x, 30+60*y); // place actor
ship.setRotation(90*Greenfoot.getRandomNumber(2)); // random direction
ship.move(size*30-30) // shift actor so end is at top/left-most location
// weed out invalid locations (placement)
if (getRotation() == 0 && getX()+size*30 > 600) continue;
if (getRotation() == 90 && getY()+size*30 > 600) continue;
if ( ! isTouching(Actor.class)) break; // verify no intersecting actors
}
// other stuff that needs done for each ship
}