Is it possible to load an image from a file?

I’m new to GDevelop5 so not sure if what I’m trying to do can be done.

Is it possible to load an image from a file, for example C:\Users\SJSRM\Pictures, and set it as the background?

I want to be able to change the picture in the file location (C:\Users\SJSRM\Pictures), then press a button and load it as the background image of the game so that I can change the background during game play with new images.

Any help would be much appreciated.

i don’t think it is possible directly with gdevelop, maybe using JavaScript inside gdevelop

Ok. I’ll try and come at it from another angle. Many thanks

First of all, try to move all the resources to the Project location.

Now to load different backgrounds, you can create separate Panel Sprite objects for them. Drag them both on the Scene Space. Make sure both the backgrounds are of the same size. If not, use the scale feature.

Place one of the backgrounds on the Game Window space, while keep the other background anywhere outside the game window. Now whenever you want to change the background, you can change the positions of those two background objects you have already created using event actions.

Am I saying something wrong @xisco?

no, everything is fine :sunglasses:

1 Like

Thanks for your reply.

If I understand you correctly, both images would need to pre loaded into the game. I wanted to be able to load from a file.

For example being able to choose a profile picture of a character and navigating to my picture folder on my desk top and choosing an image of myself.

Many thanks