☑ How do I pass values through collision events?

Hi,

I have a script that creates entities and stores references to them in an array.

each time I create an entities I also attach a collisionstart event thus:

            var newBullet = this.bulletprefab.clone();
            this.app.root.addChild(newBullet);
            this.bullets.push({entity: newBullet, timer : this.BULLET_LIFE, damage : 1});
            newBullet.collision.on('collisionstart', this.oncollisionstart, this);

then I have a function which deletes the entity it collides with

Bullets.prototype.oncollisionstart = function(result) {
    result.other.destroy();
};

But rather than delete the entity what I would like to do is pass through the damage value on the bullet through to a script on the entity but I am unsure of the syntax.

How can I pass the reference to the specific bullet or the index of the specific bullet through the collision event so that I can so something like:

result.other.script.myscript.method(bulletDamage);

Hi,
Solved the issue in the end by creating a script on the bullet object itself and moving the collision code to it. This will allow the collision event to access individual values in the bullet. Not sure what kind of performance overhead having all those script instances is having but it doesn’t appear to impact it.