does anyone know how to limit one actors movements with a random gen number?

zane1zane1 Member Posts: 15
edited November -1 in Working with GS (Mac)
have set up a random number generator (1-6) which outputs the text on screen. it works fine.
I then have a dozen or so of the same actor on the screen, each of which can rotate 90 degrees each time you touch one of them (they rotate individually, not as a group)
I would like to constrain the total number of rotations to the random generated number, meaning of it spews a 6, I want to rotate 1 actor 6 times, or 2 actors 3x each, or 4 actors 1x and 1 actor 2x, etc, etc.
once the total number of rotations is "spent" no other actors should be able to rotate until a new random number is generated.
this process should be able to continually repeat.

Does anyone know how to do this?

I tried creating a rule that stated {if the random attribute is = 1, then the actor recieves event-touch-pressed (and rotates to angle when it is)}
this works by constraining all the "rotatable actors" until and only when a #1 is generated, once it is, all "rotatable actors" can then rotate, but it does not limit the number of rotatations.

someone PLEASE HELP!?

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Try adding a game interger attribute call rotations

    Then your touch to rotate rule should be something like

    When Touch is Pressed
    And game.rotation < game.RandomNumber
    --Change Attribute game.rotations to game.rotation+1
    --Rotate 90 Degrees

    Basically the touch will no longer work once you reach the random number in your rotation count.

    ___________________________________________________________________________________
    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!! Now only $20
    AppSolute Entertainment on Facebook
  • zane1zane1 Member Posts: 15
    thanks tenrdrmer!
    this is almost perfect. I tried it out and it does nearly what I want, expect, that my number generator randoms from 1-6, and in your example once I have turned the actors 6x total I can no longer turn any more actors.
    I want/need to be able to continuously turn the actors based on the number outputted by the random number, so every time it generates a new number the "turn count" is continually updated.
    your example is very close, but how do i make this able to be contiunially used?
    thanks!
  • zane1zane1 Member Posts: 15
    ah! I figured it out! duh....very easy, I just had to add a new rule to the random number generator that changed attribute from gamerotations to 0, worked liked a charm and resets everytime!
Sign In or Register to comment.