sebamawa Posted November 15, 2014 Share Posted November 15, 2014 Hello all! First. excuse me for my english. I need to get a reference to child of a group, this in the collide function of Arcade system. Example:function update(){ collide(spritePlayer, groupPlatforms, collideCallback, processCallback, callbackContext);}I will think do some this:function collideCallback(){ //the problem is I have no functions to retrieve the child of the groupPlatforms (I have getAt(index) and getIndex(child) for example)}Any help is appreciated. Link to comment Share on other sites More sharing options...
Sam Posted November 15, 2014 Share Posted November 15, 2014 the solution is simple function collideCallback(_player, _groupPlatforms){ var yourChild = groupPlatforms.getAt(number);}the _groupPlatforms refers to groupPlatforms and getAt "returns The child that was found at the given index. If the index was out of bounds then this will return -1."All you need to know on which position your child is.number => child position in Array (example 0) Link to comment Share on other sites More sharing options...
sebamawa Posted November 16, 2014 Author Share Posted November 16, 2014 Thanks Sam, But, the problem is that I don't know the index of the child. Is possible obtain a reference to child in a collision, without know the index? Regards, Edit: Here, the solution (found in the forum): http://www.html5gamedevs.com/topic/10418-get-the-one-sprite-within-group-that-collided-overlapped/?hl=group%2Bcollision Thanks all, Link to comment Share on other sites More sharing options...
Sam Posted November 16, 2014 Share Posted November 16, 2014 yeah that's simply : function collideCallback(_player, _collidingChild){ }my bad, you can just put the reference in, and the system will detect the collision of the child of that group that collides. Link to comment Share on other sites More sharing options...
Recommended Posts