GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Touch Release Broken

11clock11clock Posts: 450Member
edited November -1 in Tech Support
I've discovered that Touch Release is broken. I have 2 actors that toggle sound and music. When I release my touch on one actor, it works. Then when I try to toggle the other actor, BOTH actors are affected by the touch release. Same thing happens when I press the other button first. I can't use Touch Press because my menu is a scrollable menu and it's set up to only push a button when the finger is in the same position when it pressed and released on the button.

This is a game breaking bug. I'd really like it to be fixed.

Comments

  • StormyStudioStormyStudio United KingdomPosts: 3,987Member
    can you show your rules in more detail... either describe them or do a screen shot...

    How are you doing the toggle buttons, if you do a forum search you'll see there is a nice little bit of rule you can use... something like

    if button released:
    Change attribute button_toggle to (Button_toggle+1)%2

    Thats probably not it...but its something that looks like that.

    and it will change an 'integer' number from 1 to 0, and 0 to 1.

    You can then use this to turn sound on or off.

    You say one button is working fine...

    double check all your rules, perhaps one of you attributes is an 'integer' when it should be a 'boolean' or vice versa....

    Happy to take a look if you'd like me to...
  • 11clock11clock Posts: 450Member
    Both buttons don't work fine. The first button you press in the game is the one that works at first, but pressing the second button will cause both buttons to screw up. It happens vice versa, pressing #2 first and #1 second.

    I am doing my toggles very similar to what you explained. Touch release, it will check to see if the boolean is true. If it is, set it to false, otherwise, set it to true. Then there is another rule that changes the button's appearance based on if the boolean is true or not and it changes the volume in similar manner.
  • 11clock11clock Posts: 450Member
    Sent my game project over via PM.
  • TheHooglerTheHoogler Posts: 102Member
    I could be wrong, but I recall reading somewhere that touch release breaks if it depends on a boolean. Try Stormy's "Change attribute button_toggle to (Button_toggle+1)%2" which is essentially a workaround boolean and see if it changes anything (since %2 signifies that the attribute can only be X or X+1, or... 0 and 1).
  • JohnPapiomitisJohnPapiomitis Posts: 6,256Member
    yes like said above dont have rules when true change to false and when false change to true, that can cause problems. Use the expression posted above: (attribute+1)%2

    its not a workaround, its modulo and the proper way to toggle in gs
  • 11clock11clock Posts: 450Member
    Alright, I changed the way the attributes are toggled to (attribute+1)%2.

    However, that didn't change anything at all. The problem is still there.
  • JohnPapiomitisJohnPapiomitis Posts: 6,256Member
    can u post a screenshot of your rules? i just tested with touch release and works fine for me.
  • StormyStudioStormyStudio United KingdomPosts: 3,987Member
    sorry 11clock...it went past 11 o'clock here so I had to head off to sleep...

    make sure your attributes are 'integer' numbers and not 'booleans.'

    and also if you have two buttons you will need two separate attributes (thats if they are game.attributes, should be fine if they are self.attributes.)

    Then have:
    if released
    change attribute
    (attribute+1)%2.

    Then if attribute = 0
    change image to image 1
    Otherwise
    change image to image 2

    ..Should work...

    if its still not working
    either send your project over to [email protected] and I'll take a look tonight.

    Or ask again here and one of us will try and help.

    Cheers...time for some breakfast...
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Note: Extra tip in life...when reinstalling iOS on phone, remember to set a new alarm for work...otherwise you'll wake up late.... just discovered this problem. doh!
  • 11clock11clock Posts: 450Member
    I have changed the attributes to integers, and I am using 2 game attributes. I doubled checked both actors and each actor only uses the attribute it's supposed to use.

    Here are 2 screenshots of the behaviors I have in the music actor. The sound actor looks exactly the same, but with game.music replaced with game.sound and it changes the sound volume instead of the music volume. Yes, I checked all Otherwise sections as well.

    http://iliveinavillage.tk/up/d684323b14d615b4a4e1cb51d00b414c.png
    http://iliveinavillage.tk/up/dc7dbc0a638d097656f4117a8141efb0.png
  • StormyStudioStormyStudio United KingdomPosts: 3,987Member
    hmm...looks like it should work...
    Not entirely sure why you have the mouse positon rule (something to do with your scrolling scene).

    If you just put you buttons in a new scene... and try them without the touch position rules...

    does it work then?

    feel free to email it to me and I'll take a quick look tonight... (1 hour left of work).

    [email protected]
  • 11clock11clock Posts: 450Member
    stormystudio said:
    hmm...looks like it should work...
    Not entirely sure why you have the mouse positon rule (something to do with your scrolling scene).

    If you just put you buttons in a new scene... and try them without the touch position rules...

    does it work then?

    feel free to email it to me and I'll take a quick look tonight... (1 hour left of work).

    [email protected]

    I just tested it out. I placed the actors in a different scene and removed the mouse position rule in both actors. They both worked like they are supposed to.

    Based on this, it appears that my toggable buttons aren't compatible with the scrollable menu. One work around could be to have an Options button that goes to a different scene where you can toggle the music and sound, but I want the menu to be only one scene.

    I'll email you the project file. Hopefully there is a way to have the toggable buttons work on the scrollable menu, otherwise I'll simply remove the option to toggle the music and sound.
  • StormyStudioStormyStudio United KingdomPosts: 3,987Member
    11clock... did you get my reply...

    problem solved...toggle buttons on scrollable page.

    changed it so each button has a self.pressed attribute.

    then if button is pressed change to 0, if released change to 1

    if its one then do the (attribute+1)%2 thing to toggle your value to turn some thing on or off.

    ...

    All works well with the scroll menu so if the player touches the button it won't activate the button until they release, so if they are just scrolling the screen and don't mean to touch the button it won't go off accidentally...

    Cheers

    Jon

    Quick advert for me:
    Grab some cool templates available over at www.stormystudio.com
  • 11clock11clock Posts: 450Member
    Yes I got your reply. I'll look at it later, as I'm currently on Windows Bootcamp.
  • 11clock11clock Posts: 450Member
    It works! Thanks! :D

    I'll add you in the credits as a bug fixer/beta tester/whatever they call the guys who fix bugs. What do you want to be credited as?
  • StormyStudioStormyStudio United KingdomPosts: 3,987Member
    thanks 11clock.. please don't feel you have to.

    just buy my next game for a few cents when its launched in the distant future... :-)
This discussion has been closed.