Can I scale sprites horizontally without distorting the edges?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ebaum

In Unity, there’s a way to import images (I think it’s called Sliced or something like that) where you can define certain margins beyond which scaling will have no effect. I can’t seem to find a way to do this in Godot and it’s driving me a little crazy. Here’s an illustration of the problem:

I like using outlines and rounded rectangles for games, and I’d like the edges to stay nice and round and the border to stay proportional. I know NinePatchRect does this, but it seems made for UI components. Does anyone know a way to get this result?

Any luck with this? I am stuck in the same problem. Here is how Unity solves this: https://www.youtube.com/watch?v=_-9MrJfbysM

d2clon | 2023-01-20 17:06

I found our solution, it is called NicePathRect: https://www.youtube.com/watch?v=OrTMWb1bN24 :slight_smile:

d2clon | 2023-01-21 16:27

:bust_in_silhouette: Reply From: Calinou

NinePatchRect extends Control instead of Node2D, but you can still use it within your game’s scenes. It will move within the scene when the camera moves if it’s not a child of a CanvasLayer node.

There is currently no NinePatchSprite node. Therefore, unless you draw it manually, using NinePatchRect is the way to go.