- Home /
flying enemy from another game and animation problem.
First of all sorry if I ask too much questions lastly but I got ALOT of problems. Now I need help with 4 problems, 3 is about the same enemy:
1: I created in another game I made a flying enemy. In the game I created everything was perfect and now I want to use it one more time but it have more abilitys: it drops rocks when it fly above me, summon other 2 enemies and land in the base (in the first game he fly untill he die). everything worked fine but I got problem when I wrote the code to summon the enemy, it don't drop the rocks anymore (task it did before) and don't summon the enemies. How I can make it works?
2: The flying enemy don't take off like he did in the other game. In the other game he took off up untill he was 40 meters in the air (distance from the land) from every spot on the land. I use that part of the script for that: function Update ()<br> {<br> landDistance = Vector3.Distance(land.position, transform.position);</p> <pre><code> if (landDistance < inAirRange) { fly (); } else { stopFly (); } if(isItAttacking) { attack (); } } function fly () { isItAttacking = false; renderer.material.color = Color.red; transform.Translate(Vector3.up * moveSpeed *Time.deltaTime); } function stopFly () { isItAttacking = true; renderer.material.color = Color.black; }
Now, in the second game, it do it only when he close to the center of the land, meens that the radius from the center of the land is the range between the land and the enemy. How to solve it?
3: (the last question about that enemy) After the enemy do all what it needs it should go back to the base. It fly back untill he get for the spot he need to land, but I don't know what code to write for landing (like a helicopter). what code to write for landing?
4: I crated an enemy with 3 animation: walk, aim and put the gun away. when I get close to him it should aim on me but don't shoot, it do the animation for that but in loops and he seems "dancing", it should do it only ones, I checked it and it on "do ones". when I get closer it getting closer to me and he should do the "walking animation". insted, it stop to "dance", not do the animation he needs to do and when it needs to shoot it start "danceing" again... What I need to do so he will stop "dancing"? (It an enemy I imprted from Blender and I never had problems with imported animations).
Sorry for very bad english...
Thing i forgot to write in question 2: the problem started before I changed the script. I wanted to check the script if it still works.
It's actually a good idea to split up separate unrelated problems and ask them in separate questions. That way if someone else has the same problem, they can find the answer easier. It also increases the odds of you getting an answer at all.
Your answer
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Flying AI enemy with many tasks 1 Answer
How to select an animation clip by index number? 7 Answers
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers