choose randomly between 4 actors?
developer6810
Member Posts: 139
I know to choose randomly between 2 objects, you create an attribute that is valued at 50 and then you have the computer choose randomly between 0 and 100 and if the attribute is greater than the chosen number, you pick one actor and if it is less than, you chose the other. How would you do that for 4 actors?
Best Answers
-
jamie_c ImagineLabs.rocks Posts: 5,772Something like this:
Set up a game attribute called "pickActor"
then when you need to pick the random actor do this:
Change Attribute pickActor to random(1,4)
Set up 4 Rules:
Rule 1:
If pickActor = 1 then pick your first actor here.
Rule 2:
If pickActor = 2 then pick your second actor here.
Rule 3:
If pickActor = 3 then pick your third actor here.
Rule 4:
If pickActor = 4 then pick your fourth actor here.
Then you have randomly picked 1 of the possible 4 actors.
Jamie
Answers
Jamie
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
If ATTRIBUTE = 1 then
If ATTRIBUTE = 2 then
HC