Jump to content

Can't index into group.children


Recommended Posts

Hey, gais.

My issue is as the title says. I create my group like so;

this.cards = this.game.add.group();

and I populate my group like so;

...for (var i = 0; i < num_cards; i ++) {    card = new Card(this.game, this.game.width/2, this.game.height/2, 'card_unknown', i, cards[this.order_array[i] % pairs], scale);    card.scale.setTo(scale, scale);    card.anchor.setTo(0.5, 1.5);    card.angle = angle * (i - 2);    this.cards.add(card);    this.game.add.existing(card);    this.card_count ++;}...

And the issue appears when I try to access 'this.cards.children[ i ]', for example. With a group full of eight cards, I will try grab 'this.cards.children[ 0 ]' and I'll get undefined!

What am I missing here, peeps?

Link to comment
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.

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.


  • Recently Browsing   0 members

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