Need help getting a joystick to have 2 different functions.

KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
edited April 2012 in Working with GS (Mac)
Hello all,
Right now I have a Joystick that you press and when moving the joystick around it determines which direction the player is shooting in. I want to be able to tap the joystick to cycle through your two weapons each time it is tapped. If I use "when touch is pressed" it will cycle to the weapon but it does it the player is just using the joystick to aim and shoot. I only want the cycle to occur if the player taps the stick. How can I go about determining if the player has taped the joystick or is pressing it down to aim and shoot? Thanks in advance!

Thanks,
image killerpenguins image

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    edited April 2012 Accepted Answer

    Hi @killerpenguins

    Something like the following should work (not tested):

    Rule: When touch is pressed
    Timer: Every 0.01 seconds ---- Run to Completion unchecked
    Change Attribute: game.Timed ----- real attribute to game.Timed + 0.01
    Rule: when game.Timed > 0.04
    -----moving the joystick around stuff
    Otherwise
    ---Your changing weapon stuff

    Rule: When touch is released
    Change Attribute game.Timed to 0

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    @gyroscope that doesn't seem to work quit right. I think I am going to try an invisible button where the joystick is. I want it if the player taps it and game.using weapon is false the to change attribute to game.using weapons true
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited April 2012

    OK; although my suggestion could incorporate your boolean switch names; either way I hope you get it to work.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    Thanks @gyroscope It is working but the opposite of what I want. I am telling it that if game.timed is < 10 then change game.using weapon to true but it changes the weapon if it is after game.time is > 10 and not < 10. Do you have any idea why that might be? Thanks again in advance!
Sign In or Register to comment.