I'm trying to set up a keyframe animation system. I already have a class set up for characters that will be using this system, and each character on the screen can and usually will have a different animation playing, so I have already come to the conclusion that the table of keyframes is going to need to be stored somewhere within the character class (my character class is called "yarnie").
And so, I have added the following to the "yarnie" table:
Code: Select all
yarnie.keylist={}
Code: Select all
yarnie.keylist= {
fbicep= {
1 {
frame=50
position=90
}
}
head= {
1= {
frame=30
position=45
}
}
}
Code: Select all
yarnie.keylist= {
fbicep= {
1= {
frame=50
position=90
}
2= {
frame=60
position=80
}
}
head= {
1= {
frame=30
position=45
}
2= {
frame=90
position=90
}
}
}
However, there's no way for the character to keep up with which keyframe he's on at any given moment, so I add:
Code: Select all
yarnie.keylist= {
fbicep= {
1= {
frame=50
position=90
}
2= {
frame=60
position=80
}
index=1
}
head= {
1= {
frame=30
position=45
}
2= {
frame=90
position=90
}
index=1
}
}
If this system works, it would allow me to have the character work toward the next keyframe by calling the body part's index using the index key inside the same table. Does that make sense? Does that work? Can that many tables be nested within one another, or should I go back to the drawing board and start over?
Does anybody have any suggestions on how I'd go about getting the indexes containing tables for frame and position to arrange themselves in order from smallest frame value to largest?
Any questions, comments, criticisms and concerns will be deeply appreciated.