Extension "Load images from a URL": How to create multiple instances?

Hi,
I would like to load images dynamically, both locally and from the server. I use the above mentioned extension from Arthuro555 (Load images from a URL - GDevelop documentation).
I have created a simple example that should load 3 images in a loop from my server and creates a “Tile” sprite instance for each.
Unfortunately, all instances display the same image. Is there not the possibility to change the image in a new instance like it is possible with variables? I wish I could understand more of the background how this concept works.

There are not so many threads about this topic, the most useful one seems to be this one, by user ddabrahim and others:

Unfortunately the attached project with the pure Javascript does not exist anymore.

Here 2 screenshot with my events, plus the result:


(The disabled “Among objects…” action unfortunately did not generate dynamic sprites here.)

screenshot-window

In short:

What is the expected result

The 3 images from the server should be loaded into one sprite each.
slices

What is the actual result

The same image is always output in all 3 sprites if I use a server path.
When I use a local path, no image is loaded at all.

I created this reduced example project:
http://picoly.de/test/demo-image-loading.zip

Would be great if you could help me here, thanks!

1 Like

Instead of loading into the resource, which modifies the underlying image resource used by all the sprite instances, you can load into a sprite instance:

image

Make sure you load the image after having creating the object, so that the newly created instance is picked :wink:

Yes, shame on me… in desperation, I tried everything possible :blush:. …also your suggestion to load one image at a time into its own sprite. I have done this again and now the last image of the sequence is loaded for all 3 sprites:

In the debugger I can’t find further infos about the loaded files:

I also tried this variant again, but (also according to the debugger) no instances are created for tiles:

I fixed it for you: demo-image-loading.zip

1 Like

First thanks for your effort!

The thing is, I have a lot of tiles to create so that’s why I tried it with code.
I have temporarly deleted the three tiles in design mode from the scene and tried with this for testing:

But why they are not respected by the next action (“Load url … into sprite ArtTile …”)?
The debugger says that there is and instance of ArtTile with no. 1 created:
Bildschirmfoto 2023-09-15 um 15.59.40

Is and object instance created in design mode in the scene different from created in the runtime mode?

PS: I’ve also tried this variant again, but then no object is created at all: