9 Patches

0 favourites
  • 6 posts
  • 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?

  • Acryte did you solve it?

  • 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.

  • 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

  • aaah, nice don't know why I didn't think of that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thx afro!

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