N
N
nikonovichk2019-06-28 17:02:44
C++ / C#
nikonovichk, 2019-06-28 17:02:44

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

2 answer(s)
G
GavriKos, 2019-06-28
@GavriKos

Unity2D code

No way. There is no such program. As well as there is no Unity3D. The engine is called Unity!
And what you want is implemented quite non-trivially - this is not one script. And it all depends on your gut.

E
Evgeny Petryaev, 2019-06-28
@Gremlin92

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 question

Ask a Question

731 491 924 answers to any question