Answer the question
In order to leave comments, you need to log in
How do I write code in Unity2D?
I have already searched the entire Internet in search of a code in which the enemy (NPC) will follow the player, and if the enemy catches up with the player, he will beat him and the player will be deprived of HP (Life).
Answer the question
In order to leave comments, you need to log in
Unity2D code
You need the coordinates of the npc and gg. Do y.x-npc.x!=minimum possible, then npc.moveto(yy) else beat(); how to hit? Very simply gg.health=gg.health-npc.streight. about the pursuit, there you have to determine how many runs per second, how to choose the direction? Npc.x=npc.x+(gg.x-npc.x) with y similarly
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question