How do I make an accordion menu?

Get help using Construct 2

Post » Fri Apr 04, 2014 4:59 pm

I thought I had taken care of the buy button being touchable. It didn't seem like it was in Chrome. In this version I set the buy button sprite to a scale of 0 when the menu item isn't active.

BTW: I'm just making a GUI for an iPhone app at work today, so it's nice to get away from that from time to time.
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Fri Apr 04, 2014 6:16 pm

May I ask why did you use 9-patch instead of sprite?
B
7
S
1
Posts: 53
Reputation: 545

Post » Fri Apr 04, 2014 6:26 pm

If you use a sprite when you change the size you can get some pixel smearing/tearing. (So it can look blurry) With the 9-patch (9-slice) the outer border pixels (# set by you) stay the same and the inner pixels are repeated.

Not only does it make the graphic look crisper when scaled it allows you to keep your file size down. So if you just wanted a solid color rectangle you could create a 3px by 3px 9-patch and scale it up to any size in app with no loss in quality, but the server only had to deliver a 3px by 3px image.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Fri Apr 04, 2014 6:44 pm

What if I want to use image or animation for menu?
B
7
S
1
Posts: 53
Reputation: 545

Post » Fri Apr 04, 2014 6:55 pm

One more thing! If there is 20 menu items, do We have to set events for them one by one? Isn't there any short way?!
B
7
S
1
Posts: 53
Reputation: 545

Post » Fri Apr 04, 2014 7:06 pm

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.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Fri Apr 04, 2014 7:08 pm

I imagine there is a better way to code the menu. That was just the fast-n-furious way to spark an idea.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Fri Apr 04, 2014 7:22 pm

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 ;)
B
7
S
1
Posts: 53
Reputation: 545

Post » Fri Apr 04, 2014 7:29 pm

I have this example, see if it helps :)
You do not have the required permissions to view the files attached to this post.
B
21
S
8
G
7
Posts: 49
Reputation: 5,274

Post » Fri Apr 04, 2014 7:44 pm

Seasky's is much nicer!
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: dop2000, TheRealDannyyy and 65 guests