Why menu screens have no buttons?

  • #1, by LebosteinFriday, 20. February 2015, 09:44 10 years ago
    Why I can not create button instances (like on interfaces) on a menu screen? Button instances with active and inactive images are ideal for menu screens. But it seems I have to build buttons laborious with objects, conditions and actions. Is this intentional or did I miss something?

    Key Killer

    621 Posts


  • #2, by loro-gamesFriday, 20. February 2015, 12:13 10 years ago
    You actually don't need any conditions for these object-based buttons. Just put the active button icon as an animation into the object and play it whenever the mouse hovers over. I think this is also how it is described in the glenfx tutorials. However it seems like setting this up as buttons would save some time maybe and give more flexibility.

    Newbie

    64 Posts

  • #3, by afrlmeFriday, 20. February 2015, 12:41 10 years ago
    Because menu scenes can be used for other things like mini-games, loading screens, credits etc. I suppose it would make sense to allow for inactive & active image / animation states but what if the developer wants to use a different method, such as: changing the opacity of the button, or changing between a static & animated button, or apply an openGL shader effect to said button on mouse over / out, etc... The current method is more flexible.

    If you wanted to create a quick & dirty snap between images on mouse over / out then you could create a single animation containing 2 frames; the inactive state & the active state. In the first frame add an execute a script action part containing...
    ActiveAnimations["anim_name"].AnimationFirstFrame  = 1
    ActiveAnimations["anim_name"].AnimationLastFrame  = 1
    

    ... the rest is simple enough. Copy / paste the execute a script action you just created above into a on mouse enter & on mouse leave action part for each of the buttons. You should change the values in the on mouse enter action part from 1 to 2. You also need to make sure the animations are set to infinite loop & that you have assigned the animation to the properties tab. You don't have to do this, of course. It's just an alternative method for the condition & 2 objects method, as it only requires one object, instead of 2 & a condition. Plus you don't have to waste time aligning the images in the 2 objects together.

    Imperator

    7285 Posts

  • #4, by afrlmeFriday, 20. February 2015, 12:43 10 years ago
    You actually don't need any conditions for these object-based buttons. Just put the active button icon as an animation into the object and play it whenever the mouse hovers over. I think this is also how it is described in the glenfx tutorials. However it seems like setting this up as buttons would save some time maybe and give more flexibility.


    Ah yeah I forgot that animations now hide the sprite image when an animation is played - good call! wink

    Ignore the method I mentioned.

    Imperator

    7285 Posts

  • #5, by LebosteinFriday, 20. February 2015, 14:50 10 years ago
    Thanks for hints!

    Is it useful/practicable to create a fullscreen interface for the title & menu screen (with buttons etc.)?

    PS: There seems a bug with the "mouse leaves area" function. If you are inside an area and you leave the screen with a change scene action, the "mouse leaves area" is not called!

    Key Killer

    621 Posts

  • #6, by afrlmeFriday, 20. February 2015, 15:17 10 years ago
    What I tend to do is create a called by other action that contains various action parts / code for resetting the menu images / animations back to their default state. Either call this action in an at begin of scene action, or in an at end of scene action.

    Hmm in the current public build, all interfaces are automatically hidden when you change to a menu scene. In the upcoming build you can define which interfaces should not be hidden. I couldn't really say whether or not it would be a good idea to use an interface or not... In 3.7.1 for instance, interfaces were not displayed correctly in menu scenes when you forced them to be shown. I don't know if that is the case in 4.x as I've not tried.

    Imperator

    7285 Posts