|
I have a pretty simple script to control an enemy. In the "Rest" function, a looped animation plays, where the enemy bounces up and down. I tried changing the animation wrap to Once, and adding a yield WaitForSeconds (Random.Range). What I wanted to happen is have the enemy bounce randomly, for instance jump, wait 2 seconds, then again, wait one, again, 3 seconds etc. All I get is a random number is chosen from the Range, and this is repeated every time, for instance a constant 2 second interval. Is there any way to achieve what I'm after please? Also, when I make multiple enemies, they all act identically (obviously). Is there any way of using the same script on, say three of them, where the random time between animations is different? I'm after the three side by side, bouncing randomly, so they're not in perfect unison. Any help gratefully received, thanks!
(comments are locked)
|
|
Not sure how any of your script is set up, but maybe you can piece some of this together with it.
(comments are locked)
|
|
Lo0NuhtiK - Thanks for your help, tweaked my code to mirror yours (it was quite similar anyway), and it worked a treat! I just need to find out why now, for my own benefit! Here was my code:
(comments are locked)
|
|
And the relevant part of the new, working one..... Thanks again :)
(comments are locked)
|
