Wednesday, March 30, 2011

flash mx codes

This is the First Person Shooter tutorial codes. Part 1:
onClipEvent (enterFrame)
{ Mouse.hide();
this._x = _root._xmouse;
this._y = _root._ymouse;
}
onClipEvent (mouseDown)
{ _root.ammo.nextFrame();
}
onClipEvent (enterFrame)
{if(Key.isDown(90)){this.gotoAndPlay(2);
}
}
onClipEvent (enterFrame)
{if(Key.isDown(80)){this.gotoAndPlay(6);
}
}


Part 3:
_root.gotoAndPlay ("gameover") ;
NOTE: the game over actionscript is only placed on your last keyframe for ammunation and health. and you can rename the gameover to the name you placed on the key label on the game over scene.
stop();
stop action is placed on other frames on your health except for the last one also remember to put the stop action on ur main frame of the game (where your guns etc are on) also place stop action on the game over frame! Part 4:

onClipEvent (enterFrame) {

onMouseDown = function () {
if (this.hitTest(_root._xmouse, _root._ymouse, true)){
_root.enemy.gotoAndPlay("
death");
}
};
}
place that on "enemy" movieclip


_root.health.nextFrame();


place that where the enemy is attacking (BEFORE HE DIES)


_root.enemy.gotoAndPlay ("attack") ;


place that on frame names, on top of the standing stance one frame after the attacking animation.


stop();


end of the death animation


Part 5:


go in the crosshair movieclip
the select the gun movieclip
and paste this actionscript on it


onClipEvent (mouseDown)

{ this.gotoAndPlay(2);
}

go inside the "gun" movieclip and place


stop();


on frame 1 and 6 frames 2,3,4,5 are animation of the gun shooting..
Connect via Meebo
 
 

No comments:

Post a Comment