Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | gp1 |
Hello,
the issue in question is that I have a picture under “res://” that has to be cut into multiple pieces.
Please consider the following partial code,
var path = "res://Images/potd-squirrels.png"
main_image = Image.new();
main_image.load(path);
and in a loop,
texture = ImageTexture.new()
piece_image = Image.new();
piece_image = main_image.get_rect(rect)
texture.create_from_image(piece_image,0);
node.set_tile_texture(texture)
add_child(node)
the challenge is that the “Image.load” doesn’t know where “res://” is when exported.
So, how do I find the picture when exported, what are the best practises for these kind of things?
Thank you so much for your time.
Make sure to double-check the path’s casing: Windows has a case-insensitive filesystem, but most other platforms have case-sensitive filesystems. If the actual path is res://images/potd-squirrels.png
, it won’t match on other platforms.
Calinou | 2019-02-01 09:26
Thank you for your time!
gp1 | 2019-02-03 14:23