hey, dont u know, can we export, for example. sprite costumes with that? i mean in 1 zip
If you do special encoding, I’m sure you could. You could probably store a JSON list of the pixels of a costume, for example.
If you're using js, then there's already a function to export costumes to .png, so I'd look into that.
can you tell me that function?
this method has a disadvantage, code does not see "this" as a sprite
Yeah. You'd need to pass the sprite somehow.
and i have no idea how
My idea would be for the script to create a function, then you can call that function with the input files.
we need some js pro here т-т
anyone who knows js т-т
I tried, but I couldn't get it working.
Progress
var script = document.createElement('script');
script.type = "module";
script.innerText = `
import JSZip from 'https://cdn.jsdelivr.net/npm/jszip@3.10.1/+esm';
import fileSaver from 'https://cdn.jsdelivr.net/npm/file-saver@2.0.5/+esm';
const zip = new JSZip(),
cst = this.costumes.asArray();
cst.forEach(costume => {
costume.contents.toBlob(blob => {
zip.file(costume.name, blob);
}});
zip.generateAsync({type: 'blob'}).then(function (content) {
fileSaver.saveAs(content, 'costumes.zip');
})`;
document.body.appendChild(script);
oh, is that because it doesn't recognize "this" as sprite?
Once you import the jszip, you should just be able to use it outside of the module script.
putting code outside module script gives error
No, I substituted "this" for the sprite and got the same result.
so you don't know what's wrong there?
no :c
okay i ll check the code, let me open my pc
is that latest code u did?
okay i cheked that code, here its not working because "this" doesnt return a sprite .-.