Jump to content

Adding tween to group one element byt don't change all the element


Gabbar Sisodiya
 Share

Recommended Posts

Hi

Thanks in Advance

I am new to phaser game development. I am trying to add tween on one member of a group. but problem is that if one member of a group is tween all the other member also tween with the same tween.

 

here is code

var circleGroup = game.add.group();
const bmd = this.game.add.bitmapData(800, 500);
 
this.game.add.sprite(170, 40, bmd);
 
var uPosX = 20;
var uPosY = 20;
var tempChild;
for (var i = 0; i < 52; i++) {
var c = bmd.circle(uPosX, uPosY, 5, 'rgb(0,200,0)');
var sp=this.game.add.sprite(170, 40, c);
circleGroup.add(sp);
if(i==5){
tempChild=sp;
}
uPosX += 15;
}
game.add.tween(tempChild.scale).to({ x:2,y:2 }, 2000, Phaser.Easing.Linear.None, true,true,2000);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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