How could I do:
To attach a movieclip (e.g. ‘footsteps’), along a path (other movieclip).
That would be within a interval for attaching one movieclip at a time.
I would need rotation, i.e, the footsteps, should rotate according with the path direction.
Thanks.
1. Create an array of coordinates – this is your path. There are a number of ways you can approach actually creating the array, but the result should look similar to this:
2. Set up your
nextStep()function or similar – this will gather information about the next step in the path such as the angle between it and your current step. You will also need to keep track of your current step, which can be represented by simply storing the index of where you’re at in the path array. Altogether, it may look like this:3. Use the above information to move – the object returned from
nextStep()can be used to alter the position and rotation of aDisplayObjectof your choice.Assuming that
entityis yourDisplayObject:4. Tidy up (optional) – Consider creating your own class to be the result of
nextStep()for tidyness, example:I’d even suggest moving all of the above into a
Pathclass so you can simply do stuff like:etc
Hope this helps.