Mouse movement speed

Non-platform specific questions.

Mouse movement speed

Postby BloodRedDragon » Fri Mar 04, 2011 11:52 pm

I was wondering if there is a function that records your mouse speed. I am trying to make a platform game where the player can use to mouse to swing a sword.
I was thinking i could make:
if (x or y velocity >=10); for the mouse speed actor
Change animation, attack+=1; for the player.

But when you have an actor following mouse it doesnt pick up velocity D:
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score

Re: Mouse movement speed

Postby AliceXIII » Sat Mar 05, 2011 12:04 am

i don't think there is an variable for mouse speed sounds like it would be cool though :P
"Taking a breath of fresh air."
User avatar
AliceXIII
 
Posts: 325
Joined: Fri Sep 17, 2010 2:36 am
Location: victoria, texas
Score: 37 Give a positive score

Re: Mouse movement speed

Postby Game A Gogo » Sat Mar 05, 2011 12:05 am

here's a way without the need of another actor, simply create this variable "Lxmouse" and "Lymouse" if you want it for the y axis too, and do this:

Code: Select all
somevar=xmouse-Lxmouse;
Lxmouse=xmouse;


in your case it might be this:
Code: Select all
if(abs(xmouse-Lxmouse)>10||abs(ymouse-Lymouse)>10)ChangeAnimation("EventActor","Player_FlyAttack","(none)","(none)",0,0,false);
Lxmouse=xmouse;Lymouse=ymouse;


NOTE
You might want
Code: Select all
Lxmouse=xmouse;Lymouse=ymouse;

in create actor as well... so that it doesn't bug for the first frame
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest