Spawn in specific location random prefab

I have a deck of card on screen. I work in javascripting. And i like when click on deck draw a card. What can i make to this work. I’d like to spawn in hand the next card in specific location and if have for exemple 4 card , the next card spawn in right of it in specific location. Thanks!

1 Answer

1

i think this would work

var cards : GameObject; //in this array you can set all cards you want to be available for `the player

function OnMouseDown()
{
    //i dont know if you use this function but this is an example
    var drawedCard : int = Random.Range(0, cards.Length);
    Instantiate(cards[drawedCard], position, rotation);
    //you have to find out what position and rotation yourself
}

good luck with it