0 Favourites

9patch issue - Images looking distored/stretched

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

    Thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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:

    1|2|3

    --------

    4|5|6

    --------

    7|8|9

    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.

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

    [attachment=0:mu44eamd][/attachment:mu44eamd]

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