I just wanted to share a technique I discovered while working on a game for work.
The game involves digging into the ground with a drill, and to achieve this, I had to do several things...
1) Get that drill moving! The drill automatically moves, and is steered with the left and right arrows. This is the easy and most obvious part of development.
2) Add a background for the earth being drilled through. I called this the 'background'.
3) Add a copy of the background above the last background, and darken it. As the drill "drills" through the earth, the top layer is revealed (by masking) and is darker, simulating depth. I call this the 'backgroundReveal'.
4) Alright. Now the tricky part. To create a realistic trail for the drill (the "tunnel" you're creating by digging), you have to mask the first background. To do this, I have an empty movieclip 'tunnel' acts as a mask to the darker background. As the drill moves, add a piece of tunnel to this movieclip.
5) The tunnel pieces don't have to be detailed, in fact it's better if they're not. Add some code to rotate them randomly and select between two or three types. The types I have look like this:
I keep one on each frame of a movieclip, then pick one randomly like this: