|Topic was automatically imported from the old Question2Answer platform.
I have objects in my scene which have all the same tree:
A StaticBody2D Node with 1-x Sprites as childs (pixel based, all sprites are 32px*32px region from a big spritesheet).
E.g. a door with upper and lower sprite, but it could be that the there are more than 1 or 2 sprites (6 for a shelf or something).
So what I want to achieve: When the player is near one of these objects and presses enter I want to show information about that object (description, name etc.) in a popup container.
AND the root of my question is if it is possible to show the sprites of the object as imageTexture/image/whatever by code.
So I know the sprites, I know there size and region position (so theoretically I can calc the new image from the sprites) so but I don’t know how I can merge these sprites into one image/texture/whatever.
In my images you can see on the first one the node with it’s 2 sprites (left door/right door). In second screen you see the popup. Currently I just show a default door image on the right in a ImageTexture, but it would be nice to see the sprites instead of the default image
Does anybody has an idea if this possible at all? I don’t even know how to search for that.
I’ve tried to add a TextureRect for each sprite, but then I don’t know how I can only set the sprite region from the spritesheet as texcture.
Thanks and regards
Edit: After some new research I found a possible solution to use viewports and add the sprites as child…I will check that out