Random Generate a card
wibbsy
Member Posts: 3
Hi
I'm very new to GS and trying to get my head around designing a high low card game based on a standard 52 card deck. A player picks a random card and the computer picks a random card and then the app simply compares to see who wins the trump.
Ive split my project into:
Menu Scene
Pick a card scene
Resolve the trump scene
In the pick a card scene I have created a card actor and I have a button that spawns a card, but I'm confused as to how to spawn a random card from a selection of 52 each with different values? Do I need to create 52 individual card actors? Or can I have a card prototype and just assign a random value on each instance that is created?
I'm very new to GS and trying to get my head around designing a high low card game based on a standard 52 card deck. A player picks a random card and the computer picks a random card and then the app simply compares to see who wins the trump.
Ive split my project into:
Menu Scene
Pick a card scene
Resolve the trump scene
In the pick a card scene I have created a card actor and I have a button that spawns a card, but I'm confused as to how to spawn a random card from a selection of 52 each with different values? Do I need to create 52 individual card actors? Or can I have a card prototype and just assign a random value on each instance that is created?
Comments
If player takes the first card, change game.Card to 1, etc.
In your card actor put a rule:
If game.Card is 1, change image to: Card1.png
And similar with the rest 51 cards
thanks for the pointers. So I'm clear, I create a card actor and add a new attribute of Game.Card (integer).
It's the second part I'm not sure of, how do I make the game.Card receive a random value? Create Rule - Attribute game.Card random(1,52)?
When an instance of that actor is spawned assign a random number to that instance's game.Card attribute between 1 and 52.
http://marketplace.gamesalad.com/#category=13&product=4809
My first basic game... didn't use tables since it was like 2years ago.. Would definitely use tables if i had to do it over.