Accessing properties of a group's children during collision

Hi, so I declare a group in my play scene’s create():

this.spaceshipGroup = this.add.group({       //
    runChildUpdate: true,
});

later in the code I add three Spaceships:

this.spaceshipGroup.add(this.shipAdd(game.config.width + 192, 132, 30));
this.spaceshipGroup.add(this.shipAdd(game.config.width + 96, 196, 20));
this.spaceshipGroup.add(this.shipAdd(game.config.width, 260, 10));

shipAdd() creates a temporary Spaceship object which it returns after initializing. (setActive, setVisible, etc)

this is the constructor for Spaceship:

constructor(scene, x, y, texture, frame, pointValue) {

    super(scene, x, y, texture, frame);       

    //store point value

    this.points = pointValue;

    this.speed = game.settings.spaceshipSpeed;

    console.log('constructing spaceship');

    // add object to existing scene

    scene.add.existing(this);

    scene.physics.world.enableBody(this);

    this.body.velocity.x = -this.speed * 60;

}

now since each spaceship has a different pointValue, if my collision code in my scene’s create() looks like this, for example:

this.physics.add.overlap(this.spaceshipGroup, this.p1Rocket, this.changeScore);

it seems to detect a collision between the spaceship group and the rocket object, but if I want the score to change based on the pointValue of a Spaceship child object in the group, would I have to make a function that iterates through the children of the group and add a collider between the rocket to each individual spaceship, or is there a smarter way to access the properties in a child in the group that the collision is happening with? I feel like I’m wrapping my head around this too hard and I’m missing something really simple from the notes or docs or whatever I’ve been trying to learn from. Is it something to do with the callback function when i add the collider?

I can provide code for other methods and functions i described here on request; this is my first time asking something here so I apologize if some formatting and stuff are off

thank you for reading!

Use the arguments in changeScore(). Second one should be a Spaceship.

Hi, yea i think my brain was just numb, was looking at some code examples online and was confusing myself over all the arrow functions and anonymous functions I was seeing. didn’t realize the two objects colliding automatically get passed as parameters for the callback function. thanks for the help!