I'm creating an Autorunner game where the platforms appear randomly in different lengths and i wanted to create a platform that looks quite realistic in the sense that the sides are not just straight rectangle lines but are sort of rugged or curved off.
Is there a way that i can use a image with rugged edges (or something similar) as my platform and the image appears correctly as a long or short platform depending on the size.
I'm having trouble trying to word this properly as it's a bit complicated to explain, so i can understand if anyone is confused. I've provided a capx file, which is just the Autorunner template. What i've done with this is added a platform image that i just quickly photoshopped from an image and inserted it into the game.
In the capx, you can see that if it's a short platform, it just cuts the image rather than resizing and if it's a long platform then it respawns the image and theres a gap in between, which doesn't look great. I know why there is a gap, as i'm using a tiled background as my platform and my image isn't really sutible for that.
If i wanted to use the image in the capx as my platform, how do i do that?
Can anyone help me out with this please?
Sounds like the 9-patch object is the right way to go for you. https://www.scirra.com/manual/151/9-patch
Thanks for the link, that does seem like what i need for my issue. I've tried to incorporate 9patch by replacing it with the tiled background block from the Autorunner template and replace everything in the event sheet with 9patch but it's not working for me perfectly, i'm not sure how to do it.
When i tried it, the platform for 9patch doesn't spawn correctly and appears stretched on some platforms. I'm guessing this is because of my image, is there a way to sort this out?
Could i get an example of it working in the Autorunner template if possible please?
I've just realised my mistake with the capx i provided, as it's just the Autorunner template with no changes
I've provided a capx of what i've done with the 9patch.
Develop games in your browser. Powerful, performant & highly capable.
I don't have time to explain what i've done, it's simple tho, check the differences between the capx, mostly chance initial nextBlock value to something lower, and use 9patch.width to calculate nextBlock value later on, instead of "block.width". Play with the 9patch offsets to get a better result
Thanks, I noticed what I left out in my capx. I have an issue with some of the platforms look stretched/distorted, any way to fix this?
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?