do On Touched for semi-transpartent button

0 favourites
  • 8 posts
From the Asset Store
J-BoB Game Button Sound Pack comes with 300 high-quality sound effects
  • All the buttons for the game are semi-transparent, so they show part of the background through (i.e. alpha of 127). The text on the button has alpha of 255 though so its nice to read.

    The problem is the on touch event for this button does not fire unless you click on the txt of the button, which is very difficult and unintuitive.

    Any ideas for a fix?

    I could drop all the touch handling, and write my own, but this is a huge pain, especially as I am sliding the text in and out (for info and settings)using the bullet behavior, and mapping the mouse position to the button positions and scaled sizes is tricky and tedious.

    Thanks for your help and ideas!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Are you talking about button objects or sprites acting as buttons?

    AFIAK there's no way to set opacity on real button objects but I might be wrong.

    If you are talking about sprites, the on touched event works in my game even with zero opacity. Try to control the collision mask.

  • Sorry, I'm talking about a sprite which is acting as a button.   Nothing I click on except the solid text part of the button will register (ill create a capx shortly).

  • can you share a capx? For me it sounds like that you put the on touch action on the text and not the image.

  • nutmix You could create a solid colored image sprite the same size as your button, place it under your button, set it to invisible in your properties window, and give it your on touch event.

  • Here is the capx for the non working touch sprites:

    It only works if you click on the + or - pixels of the sprite which have the alpha channel set to 255.

    Any thoughts to why its not working appreciated.

    Winks idea of using a hidden object underneath is probably the only workaround, but as I move this panel left and right with swipe, I can never get the objects to light up properly after (and you cant mix text and sprites in the same family). I will try pinning the invisible button to the non working button.

    Its a bit ironic that an invisible object will catch touch events, but a visible one wont.

  • Manually adjust collision polygons in an image editor so that they cover desired area of the buttons.

    At the moment it rings only non transparent area:

    <img src="" border="0" />

  • Wow, brilliant! Problem solved.

    I have never used collision polygons - all my games are casino type games.

    Thanks again guys - great help and advice!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)