How do I let user upload their own image (not from the internet but locally using file chooser or file system?) and then use that image as a frame of an existing sprite?
You might be confused because of the word URL, but that can also just be a local path like "/folder/image.png"
the file chooser has the expression FileURLAt(index)
Hi fedca, thanks for your response, but how do let the user upload the image (which is not included in the project)?
with the file chooser object
This is how you can upload a file with the file chooser and then load it into a sprite.
I also made the filechooser invisible with css, so you can place it over any other sprite and make it look better...
file.io/dSnI8DlktTPd
Hi, —, thanks for your response.
I'm unable to access the file, greeted with this message
The transfer you requested has been deleted
Develop games in your browser. Powerful, performant & highly capable.
Oh strange. Here's a new link easyupload.io/e2pw90
Wow, thank you so much, this is exactly what I was looking for.
Just one question: Can we set the animation set and then the frame? "FileChooser.FileURLAt(0)"
Yes. Just change the animation before "Load image into sprite" to which you want to set the uploaded image. The uploaded image stays in the animation, then you can normally switch between animations...
Image of project:
Project file:
easyupload.io/tbnu94
p.s.:
You can't upload to a specific frame, it always uploads to first frame of Animation AFAIK.
You are right, we can't. I'm not sure why it's so limited. Nonetheless, it does the basic job.
By the way, thanks again, I was able to figure this out.
it loads the image to replace the current frame, so just change the frame before loading from URL