00:00
00:00
Newgrounds Background Image Theme

LancersNL just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

As: Perfect Mouse Cursor

1,278 Views | 4 Replies
New Topic Respond to this Topic

As: Perfect Mouse Cursor 2006-06-11 10:21:57


Hey everyone, i''m new here and wanted to contribute a perfect mouse cursor I came up with while making a point and click adventure. This cursor will remain the same speed as your OS cursor regardless of the framerate.

This cursor is alot better than the drag method as there is no lag and you can drag objects while using the custom cursor.

I've attached the cursor in a flash 8 file, you can simply just copy the cursor movie clip into your movie and it will work without any changes to the code, if you wish to change the graphic and i'm sure you will, just change the art in the first frame of the mc.

== How to make a Perfect Cursor by Alpha eX ==

1. Create a new file in flash or open and existing one.
2. Draw your cursor on the main stage.
3. Highlight the cursor and turn it into a movie clip, set the center point to the top left corner.
4. In the first frame of the movie clip, past the following code:

Mouse.hide();

onMouseMove = function(){
_x = _root._xmouse
_y = _root._ymouse
updateAfterEvent();
}

5. Now test your movie clip.

For the lazy just download my source file and copy the cursor into your movie, update the graphic if needed.

Source: Download
If you need the file in an older format contact me and i'll upload for you.

Enjoy!

Alpha eX

Response to As: Perfect Mouse Cursor 2006-06-11 10:25:22


Old.
Wasen't really a tutorial either since you didn't explained your code. Just a copy/paste-code.


BBS Signature

Response to As: Perfect Mouse Cursor 2006-06-11 10:31:04


At 6/11/06 10:25 AM, GuyWithHisComp wrote: Old.
Wasen't really a tutorial either since you didn't explained your code. Just a copy/paste-code.

If you have a look in the source it is all explained but fair enough, I can't edit my post so here's the explination.

Mouse.hide();
// This hides the OS mouse cursor from showing in the movie

onMouseMove = function(){
//This function will do the following actions everytime the mouse is moved

_x = _root._xmouse
//This positions the movie clip to the x position of the mouse

_y = _root._ymouse
//This positions the movie clip to the y position of the mouse

updateAfterEvent();
//This code will update the cursor's postion after it is positioned making it exact to the OS mouse's postion
}

Second part,

// _root.attachMovie("cursor_mc","cursor",100
0);

// How this works,

// First part in the brackets is the name of the movie clip to add to stage

// Second part is giving that movie clip a new instance name.

// Third part is the level it is attached to,
// think of it as layers only for attached movie clips

// Hope the cursor is of use to you

===

That was my first tutorial so thanks for the feedback even tho it was rather snappy. Most people would rather just copy and paste a cursor into their flash movie rather than read about it or do it step by step.

Response to As: Perfect Mouse Cursor 2006-06-11 10:34:51


no it's not perfect. If it was perfect you would show how to do the anti-cheat stuff so you cant skip over walls or right click cheat.

Response to As: Perfect Mouse Cursor 2006-06-11 10:37:39


At 6/11/06 10:34 AM, Glaiel_Gamer wrote: no it's not perfect. If it was perfect you would show how to do the anti-cheat stuff so you cant skip over walls or right click cheat.

Perfect movement I ment, I'm sure there is another tutorial explaining anti-cheat better than I could explain it since my games don't have any frames preventing right click > play or whatever.

Thanks for the feedback