I always seem to have issues with buttons

SparkyidrSparkyidr Member Posts: 2,033
edited November -1 in Working with GS (Mac)
ok..
So, I always do my buttons in the same way

when touch is inside
--do whatever cool effect I have made to show a touch is made
When touch is released
--after 0.3(or so) seconds
----do whatever the button is for

And this works......for the most part.

Every now and then, the button just won't do the thing it's there for (change scene, change camera origin, load game centre....or whatever)

This happens when viewing on the mac as well as on the device. and maybe only happens say, 1 in 20 times....but even 1 in 20 is unacceptable.
The touch effect works 100% of the time, even if the release action fails I should point out.
So it must be something to do with my release rules???

I have tried run to completion on, or off, on the final timer, that seems to make no difference.

Anyone else noticed anything similar?

Comments

  • SkyMapleSkyMaple Member Posts: 817
    Could you post a screenshot of how the rules are set up? This shouldn't be a problem but maybe you messed something up.
  • SparkyidrSparkyidr Member Posts: 2,033
    image

    this works.. but every now and again, the release stuff doesn't happen (i.e. it doesn't change the scene)
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Well first of all your run to completion is not checked that might solve the problem you are having.

    Although if it were me I would put all of that in a touch is pressed rule. Its seems like a way over kill to use two rules for a change scene button.
  • SparkyidrSparkyidr Member Posts: 2,033
    @tenrdrmer I already said in the initial post that having run to completion checked doesn't solve the problem :(

    Also. it may be overkill, but it makes the front end far more polished and inline with what most good front ends do.
    e.g. imagine i click the button, but then realise I didn't want to press it. if I then move my finger without lifting off, the "touch release" trigger doesn't happen, and hence the button is not triggered. 99% of good front ends do this if you have noticed.
    If I had the change scene rule on the touch is pressed, it would always change the scene even if I have changed my mind.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Its also probably got to do with touch is inside instead of touch is pressed in your first rule.

    It may not trigger a release if you touch elsewhere, slide over the icon, and then release.
  • SparkyidrSparkyidr Member Posts: 2,033
    hi.. sorry, I should have said. in some other games I have it set up like that (with the touch is pressed, for the touch effect) and I still get the same issue :(
  • EastboundEastbound Member, BASIC Posts: 1,074
    I would just make a boolean variable is_pressed. Then I use the mouse functions, because they seem more reliable (and to make more sense to me). When mouse is down and inside, set is pressed to true.

    Then if mouse is up, check if is_pressed is true, and then execute your button released portion.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Eastbound said:
    I would just make a boolean variable is_pressed. Then I use the mouse functions, because they seem more reliable (and to make more sense to me). When mouse is down and inside, set is pressed to true.

    Then if mouse is up, check if is_pressed is true, and then execute your button released portion.

    That would also be my next suggestion.

    You'll want to add to the Otherwise
    When Mousebutton is down
    and Mouse position is outside
    --Change is_pressed to false

    That way if you slide off it will go false.

    But the boolean being set to true when you will release will help ensure that the entire change rule runs.
  • SparkyidrSparkyidr Member Posts: 2,033
    Thanks guys. will give that a go. see if I can get some more robust buttons on the go :)
Sign In or Register to comment.