Saturday, August 11, 2018

4.4 Limiting Layers


In theory Animate lets you have as many layers as you desire. However, you should try to limit the number of layers that you use to make managing the movie easier. Designer overload is caused by the designer having to deal with a huge number of layers. When you have too many layers to deal with, it becomes harder to find the layer you need and if there is interaction between layers that are of substantially different levels, then work can be frustrating.

To layout the game, we need to get the 40 gems to appear. If you look at screenshots for the game you will see what the final layout looks like. The problem here is that 40 gems would result in 40 layers. That is a lot of layers to keep track of. So instead of forty layers, let us group each row into a layer. Extra conservative designers would probably have all forty gems in a single layer, but I originally designed this around four layers.

Those of you familiar with Animate CC probably already know that Animate CC tends to act funny when you try having animation on a layer that contains more than one object. It wants to only deal with one object for a tween so when it has many to deal with it automatically generates its own movie clips to hold intermediate tweens. This is almost never what you want so it is best to avoid that situation. As that is the case how are we going to animate the gems? After a bit of thought, I realized that at any given time, I would only need five gems animated at a time. This can be handled by creating five animation layers.

The animation is simply handled by assigning gems to animation layers. When the gem reaches its final position, the layer it belongs to then adds that gem to it's objects. The animation layer is again free to hold another gem.

To demonstrate, lets deal with the first few gems. We create the gems outside the screen in a pattern that wraps clockwise around the screen. The first gem gets assigned to GemAnim1, which is our first animation layer. It uses simple position keyframe animation to move (the first keyframe is where the animation starts, the last keyframe has the gem where the animation ends and a motion tween is placed between the two keyframes). The second gem uses GemAnim2, the third uses GemAnim3 and so fourth. Gem number 6 has no layer, but as it will not start to be animated until gem 1 is in it's final position, it can use GemAnim1. It can do this because there is no longer an object in this animation layer as a gem has been added to the appropriate gem layer. Gem 7 is not needed until gem 2 has been placed in it's layer, so it will use the GemAnim2 layer. And so on, until all forty gems have been animated.



No comments: