private void addSprite(TileMap map,
        Sprite hostSprite, int tileX, int tileY) {
        if (hostSprite != null) {
           
            //set planet total power if planet
            //if the sprite is an instance of Planet, we are going to use the TileMap
            //function to create random planets
            if(hostSprite instanceof Planet){
            	TileMap.createRandomPlanets(this, map, (map.getWidth()+map.getHeight())/20);
            }else{
            	Sprite sprite = (Sprite)hostSprite.clone(this);
            	// add it to the map
            	// center the sprite
                sprite.setX(
                    TileMapRenderer.tilesToPixels(tileX) +
                    (TileMapRenderer.tilesToPixels(1) -
                    sprite.getWidth()) / 2);

                // bottom-justify the sprite
                sprite.setY(
                    TileMapRenderer.tilesToPixels(tileY + 1) -
                    sprite.getHeight());
            	
                map.addSprite(sprite);
            } 
        }
    }