Making a crosshair cursor

A crosshair cursor would be ideal for a shooter/hunter game. And this one procedure can be used to make a standard cursor also.
In this tutorial the crosshair will be used as the cursor also, as it is being made for a shooting game. Using the oval tool draw out a circle on the stage, make sure it has no fill. This cirle only needs be small, with a width and height of about 35. Inside this circle using the line tool, you will need to draw a cross, the middle of the lines that form the cross should intersect directly in the middle of the circle.
Select the crosshair you have just drawn, right click on it and convert it in to a movieclip. In it properties panel, give it an instance name of crosshair_mc. (make sure you do not include the full stop 'mc').
Insert another layer and rename it actions. Right click on the first frame and select actions. Put in the following actionscript:

Mouse.hide();
crosshair_mc.onMouseMove = function() {this._x=_xmouse, this._y=_ymouse;}

This tells flash to hide the mouse cursor, and make the crosshair movieclip's x and y co-ordinates the same as the mouse'.

1 comment:

Unknown said...

nice bLog! its interesting. thank you for sharing....
crosshair generator