Jump to content

vector or arrays


pranadevil
 Share

Recommended Posts

Yes:

var mySprites = [sprite1, sprite2, sprite3, sprite4];

However I would use groups because they have some methods that may come handy:

this.spriteGroup = this.game.add.group();
this.spriteGroup.add(sprite1);
this.spriteGroup.add(sprite2);
this.spriteGroup.add(sprite3);
this.spriteGroup.add(sprite4);

You can also use both arrays and groups.

Link to comment
Share on other sites

2 hours ago, icp said:

Yes:


var mySprites = [sprite1, sprite2, sprite3, sprite4];

However I would use groups because they have some methods that may come handy:


this.spriteGroup = this.game.add.group();
this.spriteGroup.add(sprite1);
this.spriteGroup.add(sprite2);
this.spriteGroup.add(sprite3);
this.spriteGroup.add(sprite4);

You can also use both arrays and groups.

 

thanks for the answer, finally could you please gimme and example of how can i figure it out "where" is an specific item in the group ?

for example is there a way to know that in index 2 is sprite3? and then erase it from the group?

 

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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