[SOLVED] Audio Error this.entity.sound.play

my audio isn’t working upon collision

Difficult to tell without seeing surrounding code. At a guess, on the collision event callback setup, the 3rd parameter was not set to pass the script context.


this.entity.collision.on('collisionstart', this.onCollision, this);

this is the code

Can you post a link to the project or the rest of the script please?


The event is on the character object (penguin) and it has no sound component on it so this.entity.sound is undefined.

ok i added the sound to the penguin (not on the coin) thank you