Making Computer Player

dyllandyllan Member Posts: 35
Hi GameSalad,

Does anybody know how to make a computer player? I have had an app idea which requires a computer player that selects things at random (5 items).

Thanks

Comments

  • BoomshackBarryBoomshackBarry Member Posts: 712
    It's a bit of an open ended question that one, but to select something at random you'd need to use the random function.

    To point you in the right direction, you'd first need to have an integer or index attribute (lets call it dice).

    Then when you need to make a selection, set dice to a random number between 1-5.

    Then you could have rules that say:

    if dice = 1 {do something}
    if dice = 2 {do something else}
    if dice = 3 {do something else}
    if dice = 4 {do something else}
    if dice = 5{do the last thing}.

    This video shows you how to get started with random numbers:

Sign In or Register to comment.