So I basically tried to use the 9-patch sprite and it didn’t behave at all intuitively.
Rather than explain what’s wrong with the existing panel sprite, I’m going to request what I want. I want a sprite that requires 9 sections. Only instead of scaling the center parts, it tiles them. This way the graphics looks exactly as I’ve drawn (pixeled) them in, however the more you scale it, the more it tiles, still leaving the corners alone, and the respective sides alone. (if you’re doing a tall panel it will tile vertically but not horizontally, etc).
To clarify, what you are asking for is the ability to tile and/or stretch the borders from the center independently from the settings of each other, correct?
From what I can see, this is not how 9-patch/9-tile/panel sprites behave in any of the engines I’ve checked. I’ve confirmed with Unity, Defold, and GameMaker Studio 2’s documentation, and all of them are a “center and edges tile, or they stretch” not either/or.
From some reading, the base renderer also doesn’t support that methodology either: PixiJS API Documentation
Doing some digging, the base math behind a 9-Slice/9-patch object doesn’t allow for this even in base renderer libraries like Libgdx: https://stackoverflow.com/questions/25203756/how-to-make-9-patch-image-with-only-center-stretched
While I’m not sure if this request is possible or not, I’ve tagged the feature request with the appropriate info incase a dev takes a look at it.
In the interim as a workaround I’d recommend making your 9 patch/panel sprite with a transparent center unchecking the “repeat borders and tile center” checkbox on the object, and then pinning a tiled sprite with the graphic in the area you want tiled. This will stretch the borders but let you have the center be tiled.
I don’t want any actual stretching. I want the sections to be tiled as appropriate. Upper left corner would remain unchanged, then on the “top” tile, that is the one between the upper left and upper right, would only tile horizontally. The sides would only tile vertically, bottom also horizontal. Anything inbetween the sides and the corners would be tiled in all directions. It’s similar to what the panel sprite does, but there’s no scaling, only tiling. The only real limitation would be the size of your tiles, so you wouldn’t be able to use just any size. For instance if the panel was 96x96, and each tile was 32x32 (3x3 array), the size would be multiples of 32. and minimum size would have to be at least 96x96. You wouldn’t be able to make a 97x113 “thought bubble” for instance, but it could be 96x128 for instance. The tile size might be any size so you could have a 6x6 tile size and 3x3 would be 18x18 – and that’s the smallest and they would have to be multiples of 6. If that makes sense? If it doesn’t I guess I could come up with an image describing what I mean.
Yep, now I don’t know what you’re asking for because based off your description above that just sounds like the standard 9-slice but you’re forcing size restrctions of the dimension, which no object in the engine will do. You could always just turn on the grid when resizing it?
Apparently you didn’t really understand what I was talking about. Some auto-tiling engines do what I was kind of talking about. I found a page that describes what I’m talking about here - Autotiling - what is it? (pt 1) from Frogatto.com
Specifically this image:
So you could literally have a 2x2 panel with only the 4 corners, a 3x3 like in the image, or any combination, for instance if you wanted that 3x3 in the image to be wider, you could make it 4x3 or 6x3 or any configuration you would like. It would only be limited by the size of tile you’re using.
To be clear, Autotiling in other engines isn’t a panel sprite or even an object type. Autotiling is a method of mapping out an indicator of some kind (such as a sprite) and then swapping which image is shown based off other rules that you establish. It’s wholly separate logic from rendered objects.
If you’d like to do something closed to that with a tiled sprite you’re better off starting with the 3x3 image and using it as a panel sprite. The engine isn’t going to implement hard restrictions on sizing of an object or an internal image (it wouldn’t have any way to know), so it won’t necessarily apply what you’re looking for.
Although I think the idea if implementing autotiling directly into GDevelop has been turned down in the past, there is a longterm (no timeline established) effort to integrate LDTK as a tilemap editor in the engine. That has Automapping/Autotiling native to the editor, so you would be able to use it to set up rules and build out your maps. This would allow you to build maps using autotiling rules, although they wouldn’t be adjustable via event logic after building the map.
Alternatively, you could look at the AutoTile extension made by Floki, GitHub - FlokiTV/GDevelop-AutoTile. Note: This will let you set up autotiles by placing a sprite, but you’re not going to see the end result until you run the preview.
If you’re not looking for autotiling, then I’m still not sure what you’re asking for, unfortunately.
Well I’m not looking for auto-tiling per se, I just wanted to show you an example of what I meant. It’s like a tiled sprite, that continuously repeats, only in this case, it puts the edges and corners on. Right now to get what I want, I basically have to make separate sprites for each section. Tiled sprites for any repeating sections, and then make sure the grid is on. It’s sort of tedious. If you could just specify a size by drawing out the “box”, would make things easier.
I guess you might could say it’s a combination of what the GDevelop Panel Sprite does, and auto-tiling. You define 9 tiles including a center with no edges up and down and left and right with respective edges, and the 4 corners. When you drag a box it will resize the box by tilesize (16-32-48 or 8-16-24-32-40-48 in the case of 16x16 or 8x8 tiles respectively) – if you wanted a 16x16 tilesize and 4 tiles wide, and 2 tiles high, it would be 64x32 you could have 65x32, because it would only add another tile width/height. So it would be either 64 or 80)
Do you understand what I’m talking about?
I believe I follow you now.
Unfortunately, as mentioned the engine isn’t going to restrict object size currently, and I don’t know that the developers would add said functionality, but I’ll update the tagging and title of the thread.
Thanks. The functionality shouldn’t be any harder than tiled sprites and using the grid. In other words coding wise, it should be not that hard to do that. As far as determining edges, might be a little more complex, but not really that much, since you’re just doing a box, and not some sort of odd shaped tiling magic