Hello
I don’t know if this question belongs in the AS3 forum, since it’s not directly code-related, but the final app will be coded in AS3, so…
This is a long post, but I want to be as clear as possible; please bear with me.
I am a newbie at coding, so I am sorry in advance if I will seem stupid.
I have to animate a swarm of six-legged or height-legged creatures. There should be around 50 creatures at all times on screen. These creatures should react to certain impulses (mouse movement, click, and bumping in each other).
Each creature will have it’s own life, meaning they do not react all at the same time (not like a particle system).
Each creature should randomly:
- settle (slow down and look around)
- sleep (stay in spot with a looping anim)
- wake up (for example when the mouse gets near)
- run away
- emit sounds when these actions occur.
Basically it is a bunch of neko’s (I am reffering to the old app with the cat).
I think I more or less have a precise idea of how to code all of this (although advices would be greatly appreciated).
My problem is:
I could just animate the legs by hand, and play the anim at different speeds according to the creature’s pace; But it wouldn’t be cool enough.
I want each creature to actually walk; that means it should move its legs, then bring its body in position. If it wants to move to the side, instead of turning around, it should move its relevant side legs and follow with its body, then bring the rest of the legs near. Like a crab or a spider in real life would do.
I am quite confused about how to do this. I am afraid the solutions that I am thinking of will hog the user’s machine if it is a bit old.
So I am not actually requesting lines of code here; I asking your opinion about how, in theory, this should be done.
I am thinking of making a leg class and a spider class. The spider class would decide where it wants to go, pick a point in direction XY at distance D from its center, then check which legs are nearer to this waypoint, bring them as close as possible to that waypoint, then bring its body, then move the remaining legs. All of this with a little delay between each leg, randomly, to make it seem less computed. The leg class would consist of two points, one anchored to the body and one that is the end of the leg. the drawing API would draw a line between the two.
The style is simplistic and clean, meaning that each leg could be represented with a single stroke.
What do you think?
I am quite anxious about this. I wouldn’t want to work days and days only to discover at an advanced stage that my reasonning is flawed or that the users having an old PC are unable to properly use my app. Any kind of help (if not an advice, an opinion, a related tutorial, an article about a related matter, similar experiences…wish me luck?) will be extremely appreciated.