### [SOLVED] Help with random number generator.

#### nomnum

• Posts: 8
Hello! Straight to the point!

Okay so i am making a simple Black Jack Game, cause im new. Just to test random number generator, because ill need random cards, i began my behavior for my main game screen where you will actually be playing.
In the attatchment you will see my behavior.
It successfully randomly enters the Ace(card1) and the 2(card2)... but no other numbers and sometimes nothing at all.
By successfully i mean all the cards are scattered and if one of the numbers corresponding to a card is selected, it will move.
it will move to its position
EG: card1 would go to x.50 if 1 is randomly picked.

To summarize, only the card1 and card2 are working.

If you have any other suggestions to perhaps changing my entire structure, plz tell me, im new and could use advice.

« Last Edit: April 08, 2012, 06:45:12 pm by nomnum »

#### rob1221

• Posts: 9473
You probably want to check the random number once for all cards, not once for each card.  Make a number attribute and set it to the random number first.  Also, make sure all your actors are selected in the behavior tab for your scene.

#### Xuruk

• Posts: 35
Hello! Straight to the point!

Okay so i am making a simple Black Jack Game, cause im new. Just to test random number generator, because ill need random cards, i began my behavior for my main game screen where you will actually be playing.
In the attatchment you will see my behavior.
It successfully randomly enters the Ace(card1) and the 2(card2)... but no other numbers and sometimes nothing at all.
By successfully i mean all the cards are scattered and if one of the numbers corresponding to a card is selected, it will move.
it will move to its position
EG: card1 would go to x.50 if 1 is randomly picked.

To summarize, only the card1 and card2 are working.

If you have any other suggestions to perhaps changing my entire structure, plz tell me, im new and could use advice.

Try generating the random number, storing it, and then checking against it.

#### Xietao

• Posts: 725
I'm with rob.
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

#### nomnum

• Posts: 8
I feel really bad. I made a simple mistake that thankfully rob pointed out, i didnt add the behavior to all the cards. Wow. Well thanks! Ima put this topic as solved, bye!

#### nomnum

• Posts: 8
On that subject, how do you mark this topic as resolved? DO you remove it?

#### rob1221

• Posts: 9473
You can add [solved] to the title.