9 Patches

Discussion and feedback on Construct 2

Post » Sat Aug 17, 2013 9:32 am

I recently ran into a problem when using 9 patches: The origin can only be placed top-left or center. If you have a meter or something that you want to shrink from the left to the right, not from the right to the left, but want to use a 9 patch, you may encounter some issues.

If you wanted to achieve this using a Tiled Background, clipping from the left to the right, it can be achieved by setting the width to a negative. This trick doesn't work with the 9 patch because of the way the margins work. If you want to do this, it requires placing the 9 patch on its own layer and then rotating the layer 180 degrees. Then you just invert the image both horizontally and vertically in the image editor. (It doesn't give you the option to rotate 9 patches so you have to do it this way)

Feels kinda dirty doing it this way however, is there any other way to accomplish this? I tried setting negative margins but that doesn't really work and I didn't anticipate it working. Is there a specific reason why they don't let people anchor the origin for 9 patches and tiled backgrounds to user defined positions aside from top-left and center? Any thoughts as to other solutions to this issue?Acryte2013-08-17 09:35:29
B
9
Posts: 12
Reputation: 477

Post » Mon Sep 02, 2013 5:18 pm

@Acryte did you solve it?
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Wed Sep 04, 2013 12:51 am

Nah man, I couldn't think of another solution so I just stuck with the Rotating layer + H/V inversion technique. Would have been nice to have figured out another way but I didn't feel like getting hung up on it if it works, since I still have plenty of game structuring left to be developed.Acryte2013-09-04 00:52:23
B
9
Posts: 12
Reputation: 477

Post » Wed Sep 04, 2013 1:31 am

maybe do it so:

if you want it to stretch X more pixels to the right, stretch it directly
if you want to strech X more pixels to the left:
move it X pixels to the left, then stretch it X pixels
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Wed Sep 04, 2013 2:01 am

aaah, nice don't know why I didn't think of that.
B
9
Posts: 12
Reputation: 477

Post » Wed Sep 04, 2013 3:34 am

thx afro!
B
12
S
3
G
1
Posts: 347
Reputation: 2,866


Return to Construct 2 General

Who is online

Users browsing this forum: Snowmany and 9 guests