The "Star Gun2" Effect
(Same as "StarGun" original, but with the effect reversed.) There is also a noticeable speed difference. This is caused because of the transparent gradient fill I put over top of the stars so they appear to fade out towards the center of the screen. Unfortunately, gradient masking of moving objects slows flash way down.

This effect is a direct descendant of the "Detect Mouse Angle" tutorial on www.virtual-fx.net
It is almost exactly the same code as the "Game Gun" tutorial on VFX.
The only changes from the "Game Gun" tutorial are the following:

In the "Game Gun", there is a movie clip called "user". In the StarGun, the "user" is referred to as the "target". (This serves the same purpose... the gun shoots at the user ... target ... same thing.)

Instead of being stationery, the target's (x,y) coordinates are randomized. Each time the gun loops, it aims at the moving target, and shoots. In the "Game Gun", the gun shoots only at a preset interval. In the StarGun, the gun shoots continuously.

The "Star" movie clip is similar to the Game Gun's "Laser" shot movie clip. The only difference is, instead of checking for collision detection with the user, the "star" movie clip tests to see if it is off the screen. If it is, it them self-terminates using the "remove movie clip" actionscript command.

Other than that, all the code is identical to the Game Gun. To understand how the rest works, download the "Game Gun" tutorial, and the "Detect Mouse Angle" tutorial, which explain things in more detail.

by: