We are starting a shoot game, and for this let’s replace our mouse pointer with a cross hair to aim at our targets.
A great introduction to movie clip variables, hide method, and assigning location.
Move the mouse over the stage to move the cross hair
CLICK HERE FOR COMPLETE CLASSIC GAMING CARTOON SMART TUTORIAL
HERE IS THE SOURCE CODE!
// solutions at say-web dot com
// FREE to USE, COPY and DISTRIBUTE
var cursor:MovieClip;
//this creates the movie clip
//we will place on stage
function initializeGame():void {
cursor = new Cursor;
//Note that the class has
//Capital C on the name
//cursor with a small c is the moive clip
// name
addChild(cursor);
//this will place a cursor on stage
cursor.enabled = false;
// this will neutralize the cursor
Mouse.hide();
//This will hide our own mouse (cursor)
stage.addEventListener(MouseEvent.MOUSE_MOVE, dragCursor);
// this functions fires when the mouse moves
// changes the cursor location
}
function dragCursor (event:MouseEvent):void{
cursor.x=this.mouseX;
cursor.y=this.mouseY;
// this will place the cursor on stage according
// to the mouse coordinates
}
initializeGame();
//thanks for watching
// see you on lesson 2



October 19th, 2009 at 3:26 am
You are a legend, took me a while to find a good tutorial like this that helped me hide the mouse and make an object move with the cursor.
5 stars *****
ta