Best method for rollover buttons

  • I am new to C2 and have been trying to figure out how to create a basic rollover for buttons on my title screen. I have come up with a few options but now I am in question as to which method is best and provides the best performance or if there is yet another method in which I can try. From cruising the forums I was able to come up with the follow two methods. Any thoughts or critique on what is the preferred method and why it is preferred would be much appreciated. Thanks for the time!

    Started here...

    <img src="http://i.imgur.com/vfxXEDV.png" border="0" />

    I then read something slightly different and adapted to this...

    <img src="http://i.imgur.com/RpO69VR.png" border="0" />

    I then landed on a multi button version where I have a condition for each of the button rollovers but am adjusting the off state of the mouse and cursor with a single rule. I am not sure if this is efficient?

    <img src="http://i.imgur.com/omCtMFs.png" border="0" />

    Again, thanks for the time and any thoughts are appreciated.

  • The first one looks fine...Instead of the Else you can use the same event twice and invert it if you want. Mouse Cursor is over btnStart > Right click > Invert. This will then set the anim to default when the mouse cursor is not over a btnStart object but the Else should suffice anyway..

  • I've been working on a solution from scratch after my current game got kinda messy with UI stuff.

    Here's my current WIP solution: https://www.dropbox.com/s/fwcf2n9iyqt2hn7/buttons.capx

    It's optimised to use minimum texture memory, work across touch/mouse and support toggled states.

    Hope that helps.

  • You may want to use something like imgur or similar to host images, as the host site is not allowing remote linking/embedding of the pictures.

    Here's what I'd do, to create a windows style button :

    <img src="http://i.imgur.com/2EDY3ma.png" border="0" />

  • Appreciate all the responses and will look them over closely! Thanks JohnnySix for the heads up on the images. I have jumped on to imgur and am linking the images from there. I thought they were public via evernote but turns out I was either doing something wrong or the exact image URL is still https where as the public link that you can share may not be.

    Thanks again and appreciate such a great response to my first post on the forum! Loving the C2 community thus far and am learning a lot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have been approaching this the same way you started but I am using families and simplified it a bit. Each time I add a new button that needs a hover state OR a mouse over state I simply add it to that family and its logic is taken care of vs doing it for each button.

    <img src="http://neversettle.it/forums/contsruct-mouse-over.jpg" border="0" />

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