How do I make an accordion menu?

0 favourites
From the Asset Store
ready made menu you can download this one or just follow my tutorial to make it yourself
  • An image works as long as there is a center section in the vertical and/or the horizontal that is repeatable. The number of pixels in that center section will then determine the size increments that you can scale the image up. Say for example you have a 15 x 15 image that can be broken up into 9 - 5 x 5 pixel units. If 5 pixels are repeatable in the horizontal and vertical you could scale it up to 20 x 20, 25 x 25, 30 x 30, etc... But if you scaled it up to say 27 x 27 you would only get a partial repeat of the center 5 pixels and it would be obvious.

    I don't know if that made any sense. If it didn't I'll make an example when I get off work.

    As for an animation, you could use 9-patch as a background for the animation, but I think that is about it.

  • I imagine there is a better way to code the menu. That was just the fast-n-furious way to spark an idea.

  • Thank you very much shirokuma

    I just changed 9-patch to sprite becouse I have some image to use in menu,

    Let's just look for easiest way to code that, I have at least 6X10 menu to code, and you can imagine how much time it takes!

    Get back to work please, see you after work

  • I have this example, see if it helps

  • Seasky's is much nicer!

  • It looks great, let see how can add sprite to it as a button!

  • Mazdakfx

    Every so often I'm getting a strange bounce when Seasky's menu closes. Are you seeing that too?

  • shirokuma

    Yes, there is an strange bounce on close time!

    Actually I think it need too much time to change it! Isn't it better to get back to your way and find a short way for that?

  • Mazdakfx

    Every so often I'm getting a strange bounce when Seasky's menu closes. Are you seeing that too?

    Haha, I saw that too, but I was too lazy to fix it...

    But I just put a max() and min() and it doesn't bounce anymore

    And now there is a button in the end

  • Seasky

    Great job, well done.

    Just one more thing! As I said I need to use image instead of 9_patch, one image for open menu and one for close menu, is there any way to do that?

  • Mazdakfx

    Like this? However the sprite will stretch

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A good example for why to use a 9-patch instead of a sprite! Thanks!

  • Seasky

    Thank you.

    If you change sprite frame when it touched, it's gona fix stretch.

    For example, Frame 0>> Ysize=64, and Frame 1>> Ysize= 128>> on touch change animation to frame 1.

    One more thing, when item A is open and item B touched, close item A and open item B,...

    Also I need to pin different sprites in left side of item (instead of Text_Item) as you can see in my screen shot in first page.

    Regards

  • Why I don't have Ajax and Function in my object list?!!

  • Mazdakfx

    Do you have a personal license copy of C2? I know you need it for functions.

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