Page 1 of 1

9patch issue - Images looking distored/stretched

PostPosted: Wed Jul 02, 2014 10:29 am
by tomhaiger
I'm using 9patch for my autorunner game to create my platforms, but i'm having trouble with them as some of the platforms appear distorted/stretched at times. Since the platforms appear in different sizes, it's pretty important for me to get this fix, only i don't know how to fix it.

I reckon the reason is because of my sprite for my platform, the fact that it's a large image and has to shrink down to make the smaller platforms, but is there a way to fix this so the it appears correctly when its a smaller platform?

If it is my image thats the issue, what would be the best way to go about using an image to represent a platform for an auto runner bearing in mind that platforms can appear in different types of sizes?

I've provided a capx file so you can see my issue. Would appriciate any help in fixing this.


Re: 9patch issue - Images looking distored/stretched

PostPosted: Wed Jul 02, 2014 5:19 pm
by FragFather
I downloaded your example and, I don't believe a 9-patch is the right object to use for it. See the reference link about what a 9 patch is: ... tch-Images


Using a 9 patch, any time you scale the platform, positions 2, 5 and 8 in the above diagram would be stretched or tiled (if you set the property to tile) any time you scale it horizontally and positions 4, 5 and 6 would be stretched or tiled if you scale it vertically. Positions 1, 3, 7 and 9 would never stretch causing the strange results you are seeing.

If anything, I would suggest you either just use a simple sprite object, or create a platform image which can be easily tiled. If you create 9 different images (4 corners and 5 easily tile-able center images, you could then combine them and use the 9 patch object set to tile. You would just want to make sure the object always scales to a multiple of the height/width of the tiles.

Re: 9patch issue - Images looking distored/stretched

PostPosted: Thu Jul 03, 2014 9:21 pm
by brunopalermo
Make sure the image you use is suitable for the 9 Patch object type. I changed the image you use for one that I found online and it works fine (despite the small lines which is a problem with the image itself).

Autorunner Template %289patch%29.capx