Gabbar Sisodiya

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

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);

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.