How do I do this?

rinorino Member Posts: 17
edited November -1 in Working with GS (Mac)
How should I approach this?

I would like to make a button on the scene so that when it is clicked, it will spawn a menu that allows the person to choose the different type of weapon he will equip. Here is how I did it so far but need help.

I made a button so it spawns 2 actors (the choice of weapons). In actor 1 (lets say a knife), when it is clicked, attribute of 'weapon' changes to weapon+1.
My main player of the game then has a rule that says when attribute =1 then it will destroy it self and spawn another actor that looks exactly the same exact it has a knife.
My other actor will be weapon -1, so when the attribute of weapon=0, my original actor spawns and the knife actor is destroyed.

My problem is: If I accidently pressed 5 times the knife icon, then my attribute will be +5 and I would need to click 5 more times on the other icon to make it spawn back the original. how to do set a limit or something so I only need to click once to change.

Thank you!

Comments

  • calvin9403calvin9403 Member Posts: 3,186
    rino said:
    How should I approach this?

    I would like to make a button on the scene so that when it is clicked, it will spawn a menu that allows the person to choose the different type of weapon he will equip. Here is how I did it so far but need help.

    I made a button so it spawns 2 actors (the choice of weapons). In actor 1 (lets say a knife), when it is clicked, attribute of 'weapon' changes to weapon+1.
    My main player of the game then has a rule that says when attribute =1 then it will destroy it self and spawn another actor that looks exactly the same exact it has a knife.
    My other actor will be weapon -1, so when the attribute of weapon=0, my original actor spawns and the knife actor is destroyed.

    My problem is: If I accidently pressed 5 times the knife icon, then my attribute will be +5 and I would need to click 5 more times on the other icon to make it spawn back the original. how to do set a limit or something so I only need to click once to change.

    Thank you!

    You will need A LOT of save attribute and load attribute in 0.9.0
  • rinorino Member Posts: 17
    Thanks again guys. Would anyone please kinda very quickly teach me how to use save and load attribute or what it does? Thanks!
  • ValanValan Member, BASIC Posts: 410
    To place a limit to clicking you can use '>0' rather than '=1'.

    Another way is to spawn another actor that covers the first and makes it look checked. Clicking again on the checked actor makes weapon<1 and destroys the checked actor to leave the original.

    Hope this helps

    Cheers
Sign In or Register to comment.