ok so i am trying to get the player to die when they collide with the enemy… this is my code right now:
Enemy.prototype.onCollisionStart = function (result) {
if (result.other.rigidbody) {
this.deadText.enabled = true;
this.player.destroy();
}
};
but this calls an error in the gun script here:
if(this.entity.script.enabled){
this.app.mouse.enablePointerLock();
}
but when i remove this.player.destroy();
it works just dandy, well except that when the bodies collide
the text thats supposed to say you are dead (this.deadText.enabled = true;
) only flashes not staying on the screen
if anyone knows why this happens please help me. here is the project link so you can see what i am talking about
thanks,
Nathan