- Home /
How can i make when player is next to enemy player die/
Hello i am new to unity and i want to ask how can i make when player is next to enemy player dies and game quits. Thanks for reading :)
If you know nothing about program$$anonymous$$g (as it seems from your previous question), you need to supply more detail. Eg: Do you have a player? An enemy? What do you mean 'next to' (touching or within a certain range)? Or, really, go do tutorials.
If you do know scripting basics, then use ray casting, distance check or collider + OnCollision etc. If you DO know basics, I will explain how to do one of those - it won't be everything you need, you must know the basics.
I know the basics btw in the other question i made the script by my self.Any way, i have player and the enemy(ghost) and i want when ghost touch the player, player dies. Could you please help me? Thanks.
Answer by brunopava · Aug 21, 2012 at 08:53 PM
You could set up triggers around the players so when one enters another's trigger you take an action via the function OnTriggerEnter()
And for the other part you shoud check Application class and find out what function suits your better.