The problem is that you can't produce animation by doing a series of discrete movements inside a loop. This is because the statements in the script execute between frame-drawing. All those movements will happen very quickly and then when the next frame is drawn, the bullet will already be at the target.


If you want script to execute for the next few frames, you need a way to say "execute this script in the future". You can use an onEnterFrame handler for this, or setInterval.

Here's an example:

code:

on (release) {
shootx = _xmouse;
shooty = _ymouse;
CowboyMC.play();
duplicateMovieClip(bullet,bullet01,1);
bullet01._x = CowboyMC._x;
bullet01._y = CowboyMC._y;

bullet01.onEnterFrame = function()
{
this._x = bullet01._x - 5;
this._y = bullet01._y + shooty * 0.2;
if (this._x >= shootx || this._y >= shooty)
{
// we're there, delete this eventhandler so we stop moving
delete this.onEnterFrame;
}
};
}