2

I'm working on a game where there are 4 characters on screen, each with several different states and corresponding MovieClips so that my library looks a little something like this:

Character 1:
IdleAnimation
SleepAnimation
..
Character 2:
IdleAnimation
SleepAnimation
..

Each animation (provided by a 3rd party) has a different anchor point, so when character A is at position 100, 100 on screen and moves from the idle to sleep animation he suddenly jumps 20 pixels to the right due to the anchor point.

Usually I would store all the different states in one MovieClip in separate frames and manually adjust the position of each one til they matched up, however I am also trying to port this to Android and therefore must keep the number of children on screen at once to a minimum.

Is there anything else I can do other than store offset x and y values for each character and each animation, and simple set the x/y via code whenever their state changes?

Simon McArdle
  • 893
  • 6
  • 21
  • why not combine all the animation for each character in a single mc - I understand you have a lot to go through, but keeping track of all that extra data can lead to errors. You'll have to verify it all anyway, using Onion Skinning would make this much more easier in the timeline. – Gone3d Jan 04 '13 at 15:49
  • I usually would do this, store each state in a single frame of one encompassing MC however this sends the children-on-screen count through the roof and I'm trying to keep it as optimized as possible for when I port it to Android. – Simon McArdle Jan 04 '13 at 15:54

1 Answers1

0

To keep the numChildren down I guess you have no choice

but to keep track of x- and y-offsets of the animations of each character

stored perhaps in an Object variable of form { state: registration_point }.

Then when changing states you can set the registration point

through this method by Emanuel Feronato:

http://www.emanueleferonato.com/2010/08/04/changing-a-movieclip-registration-point-on-the-fly-with-as3/

An idea to try though is to simply place the registration point to the center of each animation state:

    var reg_x:Number = mc.width / 2;
    var reg_y:Number = mc.height / 2;
khailcs
  • 328
  • 1
  • 9
  • Yeah I ended up having to go through all 28 movieclips and setting the registration points as close together as possible. This and storing offsets seem to be the only solution to the problem.. That or hire a better artist! – Simon McArdle Feb 06 '13 at 10:26
  • At least you have gained xp in artist hiring skills. ^_^ – khailcs Feb 06 '13 at 11:15