Make an actor change trasparency with mouse movement

Talk about making games.

Make an actor change trasparency with mouse movement

Postby DBGames » Fri Jan 28, 2011 3:44 pm

i have an actor that needs to change transparency when
a.) my mouse is moving
or
b.) my mouse is still
how do i do it?
User avatar
DBGames
 
Posts: 113
Joined: Wed Jun 24, 2009 10:13 am
Location: Bismarck, North Dakota
Score: 8 Give a positive score

Re: Make an actor change trasparency with mouse movement

Postby NightOfHorror » Fri Jan 28, 2011 10:58 pm

YOUR BACK! :D
viewtopic.php?f=2&t=12136
"I have not failed. I just found 10,000 ways that wont work." quoted by Thomas Edison.
Over the year, I decided my motto for me is I am knowledgeable, but not practical.
User avatar
NightOfHorror
 
Posts: 1823
Joined: Fri Aug 27, 2010 2:50 am
Location: Cedar Hill, MO, of the USA
Score: 51 Give a positive score

Re: Make an actor change trasparency with mouse movement

Postby skydereign » Sat Jan 29, 2011 6:15 am

Create two variables, one for xmouse, and one for ymouse. Something like mousexp and mouseyp.
view -> Draw Actor -> Script Editor
Code: Select all
mousexp=xmouse;
mouseyp=ymouse;


Then if you want to know if the mouse is moving, use this.
Code: Select all
if(xmouse!=mousexp || ymouse!=mouseyp)
{
    // execute code
    // so if you want to change transparency, do it here (this would be a draw event then)
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Make an actor change trasparency with mouse movement

Postby Game A Gogo » Sat Jan 29, 2011 1:06 pm

wouldn't it be easier to have the view's code just after the other code?
Unless view's draw actor is always executed last... which should be quite handy
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

Re: Make an actor change trasparency with mouse movement

Postby skydereign » Sun Jan 30, 2011 12:15 am

Yeah, that was a possible problem, but it worked when tested, but I don't actually know if it is executed last. The reason I didn't want to put it at the end of the visibility code is so that multiple actors can have the event triggered.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest