Grandro

AnimatedSprite.prototype.update doesn't update (RPG Maker MV)

Recommended Posts

I am trying to write a plugin for RPG Maker MV, which uses Pixi.js.

The problem may be an incompatibility, but I have asked several people now and I just don't know where else to ask.

The PIXI Version I tried it on was 4.5.4

 

Kreaturen.Kampfsystem.StarteKampf = function () {
        // Kampf Übergang
        
        for (var i = 1; i <= Kreaturen.Kampfsystem.KampfÜbergang.AnzahlFrames; i++) {
            Kampf_Anfang.frames.push(PIXI.Texture.fromImage(Kreaturen.Kampfsystem.KampfÜbergang.Pfad + i + '.png'));
        }

        Kampf_Anfang.anim = new PIXI.extras.AnimatedSprite(Kampf_Anfang.frames);
        console.log(' Kampf_Anfang.anim: ',  Kampf_Anfang.anim);
        Kampf_Anfang.anim.animationSpeed = 0.5;
        Kampf_Anfang.anim.loop = false;
        Kampf_Anfang.anim.gotoAndPlay(0); // force reset frame
        
        Kampf_Container.addChild(Kampf_Anfang.anim);
        SceneManager._scene.addChild(Kampf_Container);

        Kampf_Anfang.anim.onComplete = function() {
            console.log(88888)
          Kreaturen.Kampfsystem.KampfAktiv = true;
        }
        
        
    }

Everything works fine, the picture gets displayed but the animation just doesn't play... And because of that the .onComplete function never triggers

Does anybody have an idea why this may occur?

 

Share this post


Link to post
Share on other sites

yes very strange , it work if we run your project on web fireFox
But not in rmmv (chromium)

on firefox if you add console log in 
AnimatedSprite.prototype.update = function update(deltaTime) { ...

it will work.
but with your project , if we run it in rmmv, the AnimatedSprite.prototype.update from pixi.Animation just not work, i don't know why sorry my friend.
It very strange ! 

 .onComplete() will not work because it called inside the AnimatedSprite.prototype.update 
Maybe you have a plugin that replace the update .. or i don't know ...
hard to say..

 

Share this post


Link to post
Share on other sites

ok i have solution for you my friend. 

not sure since when, but now all animations Sprites also include Video elements need to hack update.
I don't know if it chromium and node js or the new rmmv core 1.6.1 , but pixi tikers not seem scoped animore to the update.
Need to do it manually.

PIXI.loader
    .add('titleScene/bgsTextCommands.json')
    .load(onAssetsLoaded);

function onAssetsLoaded(){
    // create an array of textures from an image path
    var frames = [];
    for (var i = 0; i < 15; i++) {
        var val = i < 10 ? '0' + i : i;
        frames.push(PIXI.Texture.fromFrame('bgTextCommand_000' + val ));
    };

// here the way
// create a container and animation sprite
    var aniContainer = new PIXI.Container();
    var aniSprite = new PIXI.extras.AnimatedSprite(frames);
    aniContainer.addChild(aniSprite);
// hack update tiker (rmmv chromium seem not take anymore the core shared tiker, i don't know why)
// you need to scope the tikers or force a default value.
    aniContainer.update = function(detla=1){
        aniSprite.update(detla);
    }

// add container to rendered screen
    SceneManager._scene.children[0].addChild(aniContainer); 
}

also @ivan.popelyshev

i you have any idea why it look like that now !, am interested to know :)

note if we force run project on firefox it working no need hack !!
But in rmmv, with chromium and nwjs, we need manually hack.

Share this post


Link to post
Share on other sites
On 6/22/2018 at 4:20 PM, Grandro said:

@jonforum Thank you alot dude! I will try it out in the next days/week and tell you whether it worked out :)

I completely forgot that I removed it every time .
this plugin added by the Kadokawa team is demonic.

he was crushing the pixi.Tiker for update animation in the core

remove 

<script type="text/javascript" src="js/libs/fpsmeter.js"></script>

and disable in the core , and pixi will work without hack

Graphics._createAllElements = function() {
    this._createErrorPrinter();
    this._createCanvas();
    this._createVideo();
    this._createUpperCanvas();
    this._createRenderer();
    //this._createFPSMeter();
    this._createModeBox();
    this._createGameFontLoader();
};

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.