public static void createRandomPlanets(ResourceManager rm, TileMap t, int numPlanets){
    	int mapWidth = t.getWidth();
    	int mapHeight = t.getWidth();
    	Random r = new Random();
    	int tileFromEdge = 5;
  
    	for(int n = 0; n < numPlanets; n++){
    		int newX = r.nextInt((mapWidth-tileFromEdge)-tileFromEdge)+tileFromEdge;
    		int newY = r.nextInt((mapHeight-tileFromEdge)-tileFromEdge)+tileFromEdge;
    		 // center the sprite
    		
    		Planet newP = (Planet)rm.planetSprites.get(r.nextInt(rm.planetImages.size()-1)+1).clone();
    		
            newP.setX(
                TileMapRenderer.tilesToPixels(newX) +
                (TileMapRenderer.tilesToPixels(1) -
                		newP.getWidth()) / 2);
            
            newP.setY(
                    TileMapRenderer.tilesToPixels(newY) +
                    (TileMapRenderer.tilesToPixels(1) -
                    		newP.getHeight()) / 2);
            
            newP.setRandomTotalPower();
            newP.circle.setFrame(newP.circle.getX(), newP.circle.getY(), newP.totalPower()/Planet.POWER_TO_SIZE, newP.totalPower()/Planet.POWER_TO_SIZE);
            
    		if(canPlacePlanet(newP, t.getSprites())){
    			t.addSprite(newP);
    		}else{
    			createRandomPlanets(rm, t, 1);
    			//can't add this sprite at this location, so try again with only one sprite.
    		}
    	}
    	//System.out.println("here");
    }