How: 9-patch menu windows?

Get help using Construct 2

Post » Fri Feb 28, 2014 1:54 am

Objects involved: 9-patch, Sprite, SpriteFont

What I'm trying to accomplish: 9-patch as the menu holder, able to be moved around (by dragging an on-screen icon around). Sprite has various animation frames, each is a different "skill" icon. SpriteFont will spawn next to the skill icon sprite, and depending on the animation frame (or if I need to specify) what that skill's level currently is.

Description: I want to make menu windows using the 9-patch plugin, so it can be various windows holding various objects that can be moved about on the screen.

My first try is a skills menu, and it either needs various pages or a method to scroll up and down while keeping the contents of the menu on itself. The menu needs to be a list consisting of another object.

MOCKUP:
Image
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Fri Feb 28, 2014 4:45 am

I tend to make mockups of teh menu in illustrator, then import the mockup as a sprite, then I import just the background menu graphic, and each of the icons separately. I add the menu background as a sprite (in your case 9 patch) and then in a throw away layout, I put the Menu in place and use the mockup to decide where to put the image points. Each image point represents where my icons will show up. I align them and get them where I need them. Then whenever I call up my menu, my logic simply creates an instance of the menu background, then pins the icon sprites to the image points to make my menu. There may be simpler ways, but this gives me much control over the menu layout.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Fri Feb 28, 2014 6:31 am

Well the good news is that might work for me, because I need control. I intend on updating my game later, adding new skills, changing algorithms of current skills, etc. The ability to choose where everything goes is important because of that, and it's the general direction I've been heading.

I guess I'll experiment some more with how I want to do it all.

EDIT:
Forgot all about "pin" option. I was able to pin things to the main 9-patch window and now it's pretty easy getting all the items where I need them to be. As long as things are on screen in the editor it seems to work perfectly fine.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Fri Feb 28, 2014 8:41 pm

Awesome, glad it was useful! One easy way to do it is import the mockup as your menu sprite, place all the image points where they need to be and then replace the mockup image with the actual menu graphic in your menu.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Sat Mar 01, 2014 1:35 am

What I did instead was put on the grid and snap to grid option, arranged my icons and the likes how I wanted them, gave it the "pin" behavior and everything worked out fine. I wish I could show it off but I have tons to do before the game is ready for demonstration.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696


Return to How do I....?

Who is online

Users browsing this forum: Elliott, KSLR, Voytek and 24 guests