Forum Topic: Customisable mouse sensitivity

(129 views • 7 replies)

This topic is 1 page long.

<< < > >>
Resigned

chillyphilly

Reply To Post Reply & Quote

Posted at: 9/23/09 01:20 AM

chillyphilly LIGHT LEVEL 26

Sign-Up: 08/25/05

Posts: 714

I was wondering if there's any way to be able to change the sensitivity of the mouse speed in a flash game.
I'm developing something that involves tracking a certain target with your cursor.
I know a lot of people would like to be able to customise their in-game sensitivity to lower or higher speeds than what they've already got, rather than having to change it via their windows sens.
I want to be able set the mouse speed for the x axis and y axis individually.

Is this possible!? :O

-----------------------------| Website | 101 Signs Collab | NG Audio Portal Flash |----------------------------

BBS Signature

None

ImpendingRiot

Reply To Post Reply & Quote

Posted at: 9/23/09 01:24 AM

ImpendingRiot FAB LEVEL 09

Sign-Up: 10/22/05

Posts: 1,623

Yeah I reckon rather than having, say spaceship, be ON the mouse x/y, you have it move TOWARDS the mouse x and mouse y, that way you can adjust the variable that controls how fast the object moves towards the mouse.

http://www.actionscript.org/resources/ar ticles/163/1/Moving-towards-the-mouse/Pa ge1.html

BBS Signature

None

Jin

Reply To Post Reply & Quote

Posted at: 9/23/09 01:27 AM

Jin LIGHT LEVEL 30

Sign-Up: 09/09/06

Posts: 1,934

var speed:Number = 1.5;

function enterFrame(e:Event):void {
	mcCursor.x = (speed * mouseX) - (stage.stageWidth * speed / 2);
	mcCursor.y = (speed * mouseY) - (stage.stageHeight * speed / 2);
}
BBS Signature

None

chillyphilly

Reply To Post Reply & Quote

Posted at: 9/23/09 01:45 AM

chillyphilly LIGHT LEVEL 26

Sign-Up: 08/25/05

Posts: 714

At 9/23/09 01:27 AM, Jin wrote: var speed:Number = 1.5;

function enterFrame(e:Event):void {
mcCursor.x = (speed * mouseX) - (stage.stageWidth * speed / 2);
mcCursor.y = (speed * mouseY) - (stage.stageHeight * speed / 2);
}

Cheers for the help Jin, but can this be converted into AS2?
Sorry I forgot to mention that part :(

-----------------------------| Website | 101 Signs Collab | NG Audio Portal Flash |----------------------------

BBS Signature

None

Jin

Reply To Post Reply & Quote

Posted at: 9/23/09 01:48 AM

Jin LIGHT LEVEL 30

Sign-Up: 09/09/06

Posts: 1,934

var speed:Number = 1.5;

onEnterFrame = function() {
	mcCursor._x = (speed * _xmouse) - (Stage.width * speed / 2);
	mcCursor._y = (speed * _ymouse) - (Stage.height * speed / 2);
}
BBS Signature

None

chillyphilly

Reply To Post Reply & Quote

Posted at: 9/23/09 02:56 AM

chillyphilly LIGHT LEVEL 26

Sign-Up: 08/25/05

Posts: 714

At 9/23/09 01:48 AM, Jin wrote: var speed:Number = 1.5;

onEnterFrame = function() {
mcCursor._x = (speed * _xmouse) - (Stage.width * speed / 2);
mcCursor._y = (speed * _ymouse) - (Stage.height * speed / 2);
}

Okay, so while that does help with being able to alter the speeds, it doesn't seem practical.
My cursor starts off stage with this and if I drag my mouse off the stage to the bottom right corner the cursor mc stops and isn't even close to the edge. ( with a var speed of 0.3)

-----------------------------| Website | 101 Signs Collab | NG Audio Portal Flash |----------------------------

BBS Signature

None

chillyphilly

Reply To Post Reply & Quote

Posted at: 9/23/09 03:02 AM

chillyphilly LIGHT LEVEL 26

Sign-Up: 08/25/05

Posts: 714

I think what I'm after is impossible in flash.

I'm trying to achieve a setting which is found in most fps games these days.
I need the cursor mc to be dead on with the mouse coordinates so it can reach the edges of the stage.

So ultimately I need to be able to speed up or slow down the actual mouse settings ;o

-----------------------------| Website | 101 Signs Collab | NG Audio Portal Flash |----------------------------

BBS Signature

None

Jin

Reply To Post Reply & Quote

Posted at: 9/23/09 04:02 AM

Jin LIGHT LEVEL 30

Sign-Up: 09/09/06

Posts: 1,934

mcCursor._x = (speed * _xmouse) - (Stage.width * speed / 2) + (Stage.width / 2);
mcCursor._y = (speed * _ymouse) - (Stage.height * speed / 2) + (Stage.height / 2);

Previous code was wrong.

Also as you pointed out, the minimal speed ratio has to be 1. Anything lower than 1 will make your cursor run out of the stage before the movieclip reaches the edge. The thing with first person shooters is that the cursor is always forced to the center, eliminating the problem. Flash cannot do that.

One work around is to enable moving the stage with the arrow keys.

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 10:28 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!