So I’m back to making my horror game, I want to make a game over screen initiated by touching the enemy
Edit: Heres a link to my game so you guys know what I’m working with
https://playcanvas.com/project/1321341/overview/hide-from-him
So I’m back to making my horror game, I want to make a game over screen initiated by touching the enemy
Edit: Heres a link to my game so you guys know what I’m working with
https://playcanvas.com/project/1321341/overview/hide-from-him
Hi @Suslendrw !
You can use collisions and triggers to detect when you are touching an enemy:
You can disable the player entity like this player.enabled = false
and you can make the death screen be enabled like this: deathScreen.enabled = true
If you need any help, let me know!
Alright, thank you, I’ll give it a go
Do you think its possible to splice code from a script for menu buttons that changes the scene with this code so It changes the scene upon colliding with the trigger?
Yes, it is, all you would have to do is have the change scene code inside of your trigger function.
Would I put that within the ‘collision.js’ script attached to the player or the ‘trigger.js’ script attached to the enemy?
You could put it in either, but it would change what tag you look for, if it was in the enemy, you would look for the player tag (or name idk what your using), if it was in the player you would look for the enemy, The only difference between collision and triggers (from a very non-technical perspective) is collisions can still be solid and triggers do not have to be solid.
I have a separate script that makes the enemy chase and look for the player, it’s a script for an ai called enemy.js
Im sorry, I would look at your project but it lags on my Chromebook, but I think as long as it touches the player with either triggers or collision and looks for the player tag, it should be good.
Yeah It has a bad optimization problem
I don’t know, but this might help you:
Ohhhhh that’s actually really helpful, thank
No problem!