Random/chance buttons to move actor

gavtheliongavthelion Member Posts: 31
edited November -1 in Working with GS (Mac)
Help please. I have six actors/buttons and another main actor on screen in my chance game. By random/chance when I press a button it will or will not move my main actor from one of the six buttons. Alternatively I have been trying to make actors collide to do the same/similar thing but can not get anything to work as I do not understand the collide behavior in that all I want to instruct my actors to do is .. actor 1 collides with actor 2 to make actor 3 move etc. etc. I can not work this out either. Please help!

regards gavthelioncub at the moment. Thanks : )

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    I'm not exactly certain what you mean from your description.

    However, I can tell you that collisions are dead easy.

    Essentialy, create a rule on an actor (it's the button to the top right of your screen) and then change the properties.
    Rather than say 'when mouse button is over', click on that and choose 'collides with' and then at the end change it to the actor you want it to collide with.

    If you want it to work for many actors, put these actors in a tag. Do this by going to the HOME screen and selecting 'actors'.

    Here you'll see all the actors in your game. Drag and drop them into a tag. You can even re-name the tags. Then in the aforementioned rule, instead of just adding one actor at the end, you can specify all tagged actors (i.e. collide with actors in tag1).

    Random stuff is a function btw, that you can add to most behaviours that have the letter 'e' next to the empty box for a value. Click on the 'e', click on the middle drop down list and find rand. Then input the minimum and maximum values you want the number to be taken from.

    Hope that helps,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • CobraCobra Member Posts: 160
    With your buttons, it sounds like you want to have one "real" button that will move the actor, and the rest of the buttons will not, correct? Try something like this:

    - new game attribute "ActiveButton" (integer)
    - new game attribute "ActiveButtonPressed" (boolean)

    On some appropriate actor,
    - Change attribute game.ActiveButton to random(1,6)

    On the first button actor,
    - When mouse position is over actor AND mouse position is down AND game.ActiveButton = 1,
    Change attribute game.ActiveButtonPressed to true

    On the second button actor,
    - When mouse position is over actor AND mouse position is down AND game.ActiveButton = 2,
    Change attribute game.ActiveButtonPressed to true

    (...and so on for all six button actors.)

    And finally, on the actor that moves,
    - When game.ActiveButtonPressed = true,
    [insert whatever kind of movement you want here!]

    Hope that helps.
  • gavtheliongavthelion Member Posts: 31
    Sorry for delay in replying. Thank you very much QS - much needed info, keep up the good work. To cobra - Brilliant, spot on, that worked a treat... : ) Thank you both .... best wishes to all.
Sign In or Register to comment.