NewGuy Posted December 3, 2015 Share Posted December 3, 2015 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 More sharing options...
NewGuy Posted December 3, 2015 Author Share Posted December 3, 2015 Dammit guys, literally the second after I post I see my mistake. XekeDeath solved it the other day. Can I remove this post? The issue how I use 'this.game.add.existing' Link to comment Share on other sites More sharing options...
in mono Posted December 3, 2015 Share Posted December 3, 2015 Dammit guys, literally the second after I post I see my mistake. XekeDeath solved it the other day. Can I remove this post? The issue how I use 'this.game.add.existing' Why would you want it the post deleted? Even if it's a silly mistake, it may be useful to other people. Link to comment Share on other sites More sharing options...
drhayes Posted December 3, 2015 Share Posted December 3, 2015 I've made lots of silly mistakes on public forums and open source projects. It's cool, we're all learning here. ( = FTR, yeah, sprites can only have one parent so that call to "game.add.existing" takes them out of the card group you added them to previously. Link to comment Share on other sites More sharing options...
NewGuy Posted December 3, 2015 Author Share Posted December 3, 2015 Cheers, drhayes, yeah you never know how people on forums will act. Cheers to you all for being generally friendly! Link to comment Share on other sites More sharing options...
Recommended Posts