MV AnimatedSVBattler in Menu Screen

Yo!

I am trying to add an animated svbattler to the menu screen but have only managed to add a non animated sprite. I have looked into "SRD_AltMenuScreen_BustSelect" to try and reverse engineer and see how he did it but.. I am a beginner at coding and it may take me weeks to fully understand what's going on there. I know it has been done before but I am trying to look at a simpler code to understand the process.

I am requesting a simplified code that will do just that: add a animated svbattler to the menu screen, positioning and which battler doesnt matter for now.

My current understanding as to why my sprite wont animate is because opening the menu stops the map animations. So a custom frame counter needs to be created in order to update the sprite into animation. I have a feeling I am way off the mark here.

help! 🙂

JavaScript:
function Scene_CustomMenu() {
    this.initialize.apply(this, arguments);
}

Scene_CustomMenu.prototype = Object.create(Scene_Menu.prototype);
Scene_CustomMenu.prototype.constructor = Scene_CustomMenu;

Scene_CustomMenu.prototype.create = function () {
    Scene_Menu.prototype.create.call(this);
    this.createSVBattler();
};

Scene_CustomMenu.prototype.createSVBattler = function() {
    this._spriteActors = new Sprite_CustomActor(this.actor());
    this.addChild(this._spriteActors);
};

function Sprite_CustomActor() {
    this.initialize.apply(this, arguments);
}

Sprite_CustomActor.prototype = Object.create(Sprite_Actor.prototype);
Sprite_CustomActor.prototype.constructor = Sprite_CustomActor;

Sprite_CustomActor.prototype.setActorHome = function(index) {
    this.setHome(670, 290);
};
I managed to reverse engineer SRDudes svbattler but it only worked by putting the svbattler animation over a window(to my beginner understanding, im not sure if im right here). So yesterday I took another look at possibilities and found out about PIXI and the issue with PIXI.extras.AnimatedSprite.

Long story short here's a script that does exactly what I want if I call it on the F8 screen ( createSVBattler() ). I'm sure there's a better way to write the script, to shorten it and/or tailor it to whatever you want. Personally I'm gonna' edit the script to add a svbattler animation to the menu and equip scenes. Anyway:

JavaScript:
function createSVBattler() {
    let actor = $gameParty.menuActor();
    let img = new Image();
    img.src = 'img/sv_actors/' + actor.battlerName() + '.png';
    let ssheet = new PIXI.BaseTexture(img);
    let w = 64
    let idleanimated0 = new PIXI.Texture(ssheet, new PIXI.Rectangle(0 , 0, w, w));
    let idleanimated1 = new PIXI.Texture(ssheet, new PIXI.Rectangle(1 * w, 0, w, w));
    let idleanimated2 = new PIXI.Texture(ssheet, new PIXI.Rectangle(2 * w, 0, w, w));
    let idleanimated3 = new PIXI.Texture(ssheet, new PIXI.Rectangle(1 * w, 0, w, w));
    let playerSheet = [];
    playerSheet.push(idleanimated0);
    playerSheet.push(idleanimated1);
    playerSheet.push(idleanimated2);
    playerSheet.push(idleanimated3);
    let container = new PIXI.Container();
    let player = new PIXI.extras.AnimatedSprite(playerSheet);
    container.addChild(player);
    container.update = function (detla=1) {
        player.update(detla);
    };
    player.anchor.set(0.5);
    player.animationSpeed = .07;
    player.x = 400;
    player.y = 400;
    SceneManager._scene.addChild(container);
};

Low and behold rpgmaker forums came through; helpful community already found and fixed the bug with PIXI animated sprites. Thanks! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/animatedsvbattler-in-menu-screen.134691/