PIXI elements disappear on Pause

Seth-Rah

professional amateur
Member
Joined
Oct 29, 2017
Messages
22
Reaction score
7
First Language
English
Primarily Uses
RMMV
I have been getting issues when using the pause button in my experimentation.

It seems that every time I pause, it erases all pixi elements from the scene. is there any way to make them persist / redraw after the pause finishes?

Open link below to see footage of it occurring.

 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,615
Reaction score
1,417
First Language
French
Primarily Uses
RMMV
yes look in the Spriteset_Map
eatch time you change scene , you need add the pixi object to scene again. (addChild)

it depends on how and where you stored your pixi objects.

example here

when Scene load , it load map again.
PHP:
    pixiSSA._rmmvAlias.Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
    Spriteset_Map.prototype.createLowerLayer = function() {
        pixiSSA._rmmvAlias.Spriteset_Map_createLowerLayer.call(this);
        // this.createParallax(); from Spriteset_Map_createLowerLayer
        this.bindToMapOBJ = pixiSSA._animationControler._pictures.bindToMapOBJ; // have list of all BindToMapData bindToMapData
        this.addPixianiLayerZ(); // assign correct z index layers
    };
And i add again the child of my pixi object to the map.
with my function this.addPixianiLayerZ();

PHP:
    Spriteset_Map.prototype.addPixianiLayerZ = function() { // procced to add other layers with Z to _tilemap and TOP
        var pixiLayers = pixiSSA._animationControler._pictures;
        for(var i = pixiLayers.asignedToRMMV.length;i--;){
            this._tilemap.addChild( pixiLayers[pixiLayers.asignedToRMMV[i]]);
        };
        var pixiLayers = pixiSSA._animationControler._pictures;
        for(var i = pixiLayers.layersAsignTo_topLayers.length;i--;){
            this._baseSprite.addChild(pixiLayers[pixiLayers.layersAsignTo_topLayers[i]]);
        };
    };
in my case, when my map change , my pixi object not destroy because a store in a variable.
When map load , i just need to add this variable as child to the map.
it is an example among many, but I let you study this, these the best way to learn.

ps: pause, combat, or menu = change map scene.
 

Seth-Rah

professional amateur
Member
Joined
Oct 29, 2017
Messages
22
Reaction score
7
First Language
English
Primarily Uses
RMMV
So I have tried to implement this

I have some questions, I see you calling a lot of pixiSSA however I don't have access to it or any of the appended features.
Is this a plugin you are using or is this some of your own code?

==EDIT==

Friend gave me some insight to your code and helped me a lot with understanding it better. I think I get it now, but I will only really be able to try it out in about a week from now as I will be busy with studies. Will be sure to update the post if progress is made.
 
Last edited:

Seth-Rah

professional amateur
Member
Joined
Oct 29, 2017
Messages
22
Reaction score
7
First Language
English
Primarily Uses
RMMV
Ok, thanks for all the assistance, I understand now what you were trying to do and it seems to have worked like a charm :)
Still really new to programming so I was a bit in the dark on what you were trying to do, but I realized a bit late that you were probably storing your elements you want to recreate in their own places.

PHP:
MyGameStuff.prototype.sprites = [goRight, goLeft, testtext2]

Spriteset_Map.prototype.createLowerLayer_old = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function() {
    //use strict because the "let" call does not work without it.
    "use strict";
    //call the old method
    Spriteset_Map.prototype.createLowerLayer_old.call(this);
    //add all objects to map again
    for(let i = 0; i < MyGameStuff.prototype.sprites.length;i++){
      this._tilemap.addChild(MyGameStuff.prototype.sprites[i]);
      console.log("WE MADE IT TO THE END OF THE FUNCTION BOYS")
    }
};
I am curious about one thing though, is there a reason you declared pixiLayers twice with the same content?
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,615
Reaction score
1,417
First Language
French
Primarily Uses
RMMV
Ok, thanks for all the assistance, I understand now what you were trying to do and it seems to have worked like a charm :)
Still really new to programming so I was a bit in the dark on what you were trying to do, but I realized a bit late that you were probably storing your elements you want to recreate in their own places.

PHP:
MyGameStuff.prototype.sprites = [goRight, goLeft, testtext2]

Spriteset_Map.prototype.createLowerLayer_old = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function() {
    //use strict because the "let" call does not work without it.
    "use strict";
    //call the old method
    Spriteset_Map.prototype.createLowerLayer_old.call(this);
    //add all objects to map again
    for(let i = 0; i < MyGameStuff.prototype.sprites.length;i++){
      this._tilemap.addChild(MyGameStuff.prototype.sprites[i]);
      console.log("WE MADE IT TO THE END OF THE FUNCTION BOYS")
    }
};
I am curious about one thing though, is there a reason you declared pixiLayers twice with the same content?
yes there is 10 or more than 100 way to do and code the same result.
Each one codes according to these knowledge.
I do not recommend storing objects in a prototype.
Except if these really nessary.
This has a very negative impact on performance.

you can try to embed and get result with
PHP:
var t0 = performance.now();
doSomething();
var t1 = performance.now();
for a website, or an application, this can be ok.
But for a game, it is preferable to always opt for optimizing code.


And 2 time yes.
because
this._tilemap.addChild( pixiLayers[pixiLayers.asignedToRMMV]);
its for the tileMap in rmmv layer (z-index)
and after i add final layer Top to the _baseSprite
this._baseSprite.addChild(pixiLayers[pixiLayers.layersAsignTo_topLayers]);

_baseSprite it over all rmmv element, so am shure it maximum top rendering
_tilemap it where your event, parralaxe, event middle, botom, tiles... are rendering
 
Last edited:

Seth-Rah

professional amateur
Member
Joined
Oct 29, 2017
Messages
22
Reaction score
7
First Language
English
Primarily Uses
RMMV
Currently I am storing the objects globally because I will be using it on each map, and storing the array that holds my map elements as a prototype.
I still don't really understand how prototypes work, but I will remove them from the prototype for now then.

At this time I know nothing on performance impact, the closest I got to seeing anything impacting my performance was when I was having an object get recreated infinitely because I never erased an event.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,615
Reaction score
1,417
First Language
French
Primarily Uses
RMMV
Currently I am storing the objects globally because I will be using it on each map, and storing the array that holds my map elements as a prototype.
I still don't really understand how prototypes work, but I will remove them from the prototype for now then.

At this time I know nothing on performance impact, the closest I got to seeing anything impacting my performance was when I was having an object get recreated infinitely because I never erased an event.
i edit upper.
and you can maybe get a look at the my full script here.
I add comments everywhere.
This could help you to have some idea about my code in general.
Download the version 1.0 (unCompress dev)
the plugin are not final,but he meets my needs now
https://forums.rpgmakerweb.com/index.php?threads/pixi-spritesheets-animations-core-v1-0-texturepacker.83083/

look at the line 1940 also 731 for layer
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

I want to see the Features of the new RPG Maker.. NOW!!
Can't wait for it!
KDS
Check out some gameplay of a game iam working on :)
Me : "Wearing glasses is annoying."
*put out glasses*
Also me : "Keep mistaking 0, 6 and 8."
oh god, a new version of RPG Maker is coming soon already....
So a new RPG Maker has been teased on RPG Maker Web's Twitter. Hmm...

Forum statistics

Threads
98,126
Messages
949,482
Members
129,404
Latest member
alvin23
Top