9patch issue - Images looking distored/stretched

Just started using Construct 2? Post your questions here

Post » Wed Jul 02, 2014 10:29 am

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
You do not have the required permissions to view the files attached to this post.
B
5
S
2
Posts: 126
Reputation: 876

Post » Wed Jul 02, 2014 5:19 pm

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:

https://github.com/chrislondon/9-Patch- ... tch-Images


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.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Thu Jul 03, 2014 9:21 pm

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
You do not have the required permissions to view the files attached to this post.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
3
Posts: 624
Reputation: 3,750


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests