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:

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

One Response to “Video: ActionScript Shoot Game Part 1 Custom Cursor”

  1. fc Says:

    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


Leave a Reply

Security Code:

Free PageRank Checker

AVA Trading Forex
WIX create a FREE website.
Try ACT! 2010 Today
Accept Credit Cards
UseNeXT Fast Downloads
For Free Stuff Click Here

Get Paid for Filling Surveys


Go Daddy $7.49.com sale 125x125 Huddle Collaboration
oDesk Certified Action Script Programmer oDesk Certified Adobe Flash CS3 Designer oDesk Certified Adobe Photoshop 6.0 Designer

Compare Web Hosting Services and Prices

web hosting - Web Hosting guide to popular hosts.

Twitter Followers