@llEmill - thank you, but I am nobody’s master…
@toffer - you certainly have great skill! I guess you are talking about how to create animated objects that can be used in projects like mine (and others like Fogbuzz etc).
I started out trying to use Simeon’s Juice effects library, which has jumps, spins, bulging, squashing etc, based on tweens, and I found it was too difficult, because (as I said to him):
"Suppose I have a continuous side scroller, and the character moves along smoothly along a level surface. If he comes to a hole, he should fall in, and if he comes to a wall, he should stop. If he jumps and hits the ceiling, he should fall down.
This means I need collision code that continuously checks whether there is a surface below and in front of the character (and above, if the character is jumping).
If I use an animation effect like Juice to (say) bounce up, I can use the getActualPosition function to get the true x,y position and test for collisions with the roof. If a collision occurs, I need to stop the animation and somehow get the character down to the floor again without the help of Juice.
If I use Juice to leap up and sideways, eg to jump up onto a higher block, Juice will not realise the block is in the way, and I will have to use collision testing to decide when to stop the animation. If the player collides with the side of the block, I will also have to interrupt that, and get the player down to the floor again.
If the player jumps sideways, and there is a hole, the player will need to keep falling in a convincing way after the animation ceases (ie once the player falls below his current level), in a continuing arc rather than straight down. This means my code has to integrate closely with Juice to produce a continuous movement.
A complication is where you include a spin animation. If the player collides with the roof while spinning and partly upside down, I don’t want to really have to think about how to get him back on the ground again, the right way up, having interrupted the animation.
Another problem is that several of the Juice animations start with a slight downward movement that pushes the character partly through the floor. This causes a collision which (in my code) cancels the animation before it starts, unless I make my collision code smart enough to ignore initial collisions, which gets messy. I think none of the animations should go below the current floor level, at any stage.
Finally, there is no function to tell the developer when an animation is finished. This is important."
All this is a pity, because Juice has some great effects.
So the main problem with custom animation effects is how to interrupt them if the player collides with something while the animation is running. I came to the conclusion that it is too hard to do this, but you may have a solution. If so, I’d be very happy to hear it.