im not sure it possible to check it but you could just do the sprite.setAnimation(); again

  • -wyi replied to this.

    you could try something like

    var player = createSprite(69, 420);
    player.setAnimation("player_animation");
    function draw() {
      background("white");
      drawSprites();
      if (keyDown("space")) {
        console.log(player.setAnimation("player_animation"));
      }
    }

    though ive tested that and it doesnt work so something along the lines of that

    hmmm..... depends on how much you wanna do buut.... it could be possible just have to overwrite a few things first

    var sprite = createSprite;
    createSprite = function (x, y, w, h) {
        var newSprite = sprite(x, y, w, h);
        newSprite.currentAnimation = "";
        // unfortunately I can't map this because this uses native js... can't write a faster one in this container
        newSprite.esetAnimation = function (key) {
            newSprite.currentAnimation = key;
            newSprite.setAnimation(key);
        }
        return (newSprite)
    }

    I'll probably have to test it since i wrote it here but you get the general idea ooh wait i think i thought of a better idea actually one sec! nvm it's gonna be waay more confusing if i bring that into the mix plus the objects aren't cooperating i think this might be your best option

    im not gonna go back through my old cdo stuff but I remember there was something like getAnimation()

    ah, found it.
    sprite.getAnimationLabel()
    should do the trick

    i think it returns the sprite animation as a string

      ackvonhuelio so that was a thing! bruh i went searching for it too... was soo close I'm actually surprised that isn't a block either now i found it, anyways the thing i suggested earlier is probably better if you want to integrate new functionality to sprites rather than something that already solves your problem

      huh ive never seen that before

      Chat