Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

please help understand some pixi stuff

trapless

Villager
Xy$
0.00
1. what is new equivalent to vxa Viewport? is it Stage?
2. to move the whole stagt(child sprites included) i gotta execute ( PIXI.DisplayObjectContainer.prototype.updateTransform.call(stage); ) to update it like:
JavaScript:
Example_Stage.prototype.moveRightBy = function (distance) {
    this.x += distance;
    PIXI.DisplayObjectContainer.prototype.updateTransform.call(this);
};
3. i want to place 5 groups of 7 sprites on a stage. is it silly to have a stage with 5 child stages with 7 child sprites each? thats what i did and when i move the parent most stage the others stay behind. if i tell each child stage to updateTransform they all move too far as if *"propagation?* is happening. if anyone knows how to do this better please explain, i'll be so very grateful.
 
Last edited:

Chaucer

Towns Guard
Xy$
0.00
depends on what you're trying to do, however I think that in most cases you should only need 1 stage and 1 DisplayObject Container.
and add different groups inside of that then update them each depending on they're group for example here's some bit of code from something I'm currently working on.

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

ParticleEffects.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
ParticleEffects.prototype.constructor = ParticleEffects;

ParticleEffects.prototype.initialize = function() {
    PIXI.DisplayObjectContainer.call(this);
    this._createBitmaps();
    this._Particles1 = [];
    this._Particles2 = [];
    this._Particles3 = [];
    this._Particles4 = [];
};
basically the sections you need to notice are each particles array, now to update them each individually you'd call something like this in update.


JavaScript:
ParticleEffects.prototype.update = function() {
//this is only to check if there's something there or not, you can skip this if statement if you don't need it.
if (this._Particles1.length > 0) {
//now this is where you'd need to update for each sprite individually.
this._Particles1.forEach(function(sprite) {
//sprite is assuming you're working with sprites.
            this._updateSprites(sprite);
        });
}

}
and if you need to move them all together as a whole, you can then move the x and y of your container.
JavaScript:
$Particles = new ParticleEffects();
//depending on how you want it to move etc etc...
$Particles.x ++;
 

trapless

Villager
Xy$
0.00
DisplayObject Container.
and add different groups inside of that...
move the x and y of your container.
Thank you very much. i've had little success finding documentation about actually using pixi. what i know of it is from reading the source and trial and error. I was trying to use a stage to contain my sprites. i didnt realize the container would link things like it does. i'm very please to now have all the images in my menu slide together.

i'll use this thread to ask any other questions i may have about pixi implementation when they arise. again, thank you very much.
[doublepost=1458920611,1458666917][/doublepost]I believe I am using DisplayObjectContainer correctly now (thanks again). I have all my demos and pertinent code of that demo posted online at: trapless.site88.net click demo dates to load demos
I would really appreciate it if someone would take a little time to read my source and let me know how i could improve.
 

Chaucer

Towns Guard
Xy$
0.00
I skimmed over the code, and I don't think it really needs any improvement, it seems pretty good :D also I'm glad I was able to help, lol I had a hard time figuring it out for a while too. I had actually found documentation for Pixi 2.0.x but I lost the page or I'd have linked you to it ^^; sorry bout that heh. but it won't matter soon though, since rmmv will switch to Pixi v.4.0.
 
Top