Video: ActionScript Shoot Game Part 1 Custom Cursor

Thu, Oct 1, 2009

ActionScript

This movie requires Flash Player 9

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!

//The ActionScript 3.0 Custom Cursor
// 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

Cartoonist Drawing Tutorials

Related Articles:

, , , , , , , , , , , , , , , , , , , , , , , , ,

23 Responses to “Video: ActionScript Shoot Game Part 1 Custom Cursor”


Trackbacks/Pingbacks

Leave a Reply

You must be logged in to post a comment.

My name is Avraham Saltoun, and I live in Jerusalem, Middle East. I am currently on my mid  40's and I am a computer programming technician. Here you will find over one hundred quality video tutorials on Actionscript, and yes, I give online support for aspiring programmers, and pros as well, sharing screen on skype and delivering source code by email, click the button for live flash actionscript support now!

 
oDesk Certified Action Script Programmer
oDesk Certified Adobe Flash CS3 Designer
oDesk Certified Adobe Photoshop 6.0 Designer
Skype Me™!

$7.49 .Com! Score Savings Cartoon Smart Tutorials


1,260
Unique Visitors
Previous 30 Days
Powered By Google Analytics