Jump to content

sprite problems - moving child and mask


odelia
 Share

Recommended Posts

I have dynamic sprites (classes) in a container sprite.

When I change the x or y of the container nothings happens... 

this.menuContainer = this.game.add.sprite(0, 0);this.menuData.forEach(function(item){    obj = new DressApp.ItemBtn(this.state, xloc, yloc, this.boxImg.width, item);    yloc += obj.container.bg.height;            this.menuContainer.addChild(obj);}, this);

Also, I can't set a graphic mask on that sprite.

I tried both ways to define a mask but it still doesn't work..

var myMask = new PIXI.Graphics();//this.game.add.graphics(0, 0);//var maskWidth = this.boxImg.width;// - (this.boxImg.width * .2);var maskHeight = this.game.height * .90;myMask.beginFill(0x000000);myMask.moveTo(0, 0);myMask.lineTo(0, maskHeight);myMask.lineTo(maskWidth, maskHeight);myMask.lineTo(maskWidth, 0);myMask.lineTo(0, 0);myMask.endFill();    myMask.position.x = this.boxImg.x - (this.boxImg.width / 2);myMask.position.y = 0;    this.menuContainer.mask = myMask;

and

var maskX = this.boxImg.x - (this.boxImg.width / 2);var maskY = 0;var maskWidth = this.boxImg.width;// - (this.boxImg.width * .2);var maskHeight = this.game.height * .90;    var mymask = this.game.add.graphics(0, 0);mymask.beginFill(0xffffff);mymask.drawRect(maskX, maskY, maskWidth, maskHeight);    this.menuContainer.mask = mymask;

could somebody please help me.. :(

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...