- Home /
Question by
minimalkid1 · Sep 06, 2014 at 02:11 PM ·
drawcard
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!
Comment
Answer by LucasVmarrewyk · Sep 06, 2014 at 04:14 PM
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
Your answer

Follow this Question
Related Questions
card rotation :: Empty with two planes 1 Answer
Random Card Deal 1 Answer
[Networking] Player prefab in a Hearthstone-like card game 0 Answers
How to select specific objects in GameObject array? 2 Answers
gui draw rexture problem 1 Answer