system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
JerryHayat |
I have a huge code for generating sprites, and their number annoys me a little …
Can I create a universal link where the filename is equal to the selected variable
Example:
Old code
sprite1.texture = load ("res: // Assets / Magic RPG / Sword / Effects / 1.png")
Idea
var link = 1
sprite1.texture = load ("res: // Assets / Magic RPG / Sword / Effects / link.png")
system
2
|
|
|
|
Reply From: |
reshadiye1 |
Well, it is easy.
Firstly honestly i don’t got your problem, but probably you’re wanting like this:
var link = 1
sprite1.texture = load ("res: // Assets / Magic RPG / Sword / Effects /"sprite" + str(link) + ".png")
But you should change name of your sprites, example:
1.sprite1.png
2.sprite2.png
etc etc…
i hope this will help you.
I have already tried this option, but now I will try to change the names of the sprites
JerryHayat | 2021-03-03 17:39
Yes, also I am using this way. It is easy for me, you should change
reshadiye1 | 2021-03-03 17:44
This worked with new sprite names.
Thank you so much!
JerryHayat | 2021-03-03 18:19
Your welcome
reshadiye1 | 2021-03-03 18:21