How to get sprites in Javascript

If you are trying to get sprites and it's relevent varibles in Javascript, try to use this:

// get and print sprite's name and it's value
        var sprites = ide.sprites.contents;
        for(let i = 0; i < sprites.length; i ++) {
            var sprite = sprites[i];
            spriteName = sprite['name'];
            spriteVars = sprite.variables.vars
            console.log('spriteName:', spriteName);
            console.log('spriteVar:', spriteVars);
        }

You can also simply do just this:
variables of sprite
But if it's JavaScript you're looking for, then go for it.

change this to tutorials

JS TIP: x["y"] === x.y.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.