Jump to content

Get reference a child in a group+collision+Arcade system


Recommended Posts

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.



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

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

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?




Edit: Here, the solution (found in the forum):




Thanks all,

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...