Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Bad Voo-doo man on Thu 14/07/2005 10:45:04

Title: Animate Mouse on click only
Post by: Bad Voo-doo man on Thu 14/07/2005 10:45:04
I know how to animate the mouse cursor when its over a hotspot/object, or moving..but I can't figure out how to get it to animate only when clicked..It's probably something simple, but I can't find it in the help files
Title: Re: Animate Mouse on click only
Post by: Gilbert on Thu 14/07/2005 10:50:58
Put the animate codes in the on_mouse_click() function of the global script.
Title: Re: Animate Mouse on click only
Post by: Bad Voo-doo man on Thu 14/07/2005 10:52:29
I figured that much ;) I just can't figure out the code, theres nothing I can find thats like the code for animating everything else
Title: Re: Animate Mouse on click only
Post by: monkey0506 on Thu 14/07/2005 17:09:55
Well if you wanted to allow it to animate if you clicked on a GUI then you could try something like:

/* rep_ex */
if (mouse.IsButtonDown(eMouseLeft) || mouse.IsButtonDown(eMouseRight)) {
  int mouse_view = -1;
  if (mouse.Mode == eModeWalkto) mouse_view = WALKCURVIEW;
  else if (mouse.Mode == eModeLookAt) mouse_view = LOOKCURVIEW;
  /* etc. */
  mouse.ChangeModeView(mouse.Mode, mouse_view);
  }
else mouse.ChangeModeView(mouse.Mode, -1);


That way any time you click the mouse (either button) the cursor would animate with the proper view.  However you would have to manually assign the value of mouse_view.  Or you could just do something like this in the "if (...IsButtonDown...) {" block:

if (mouse.Mode == eModeWalkto) mouse.ChangeModeView(mouse.Mode, WALKCURVIEW);
else if (mouse.Mode == eModeLookAt) mouse.ChangeModeView(mouse.Mode, LOOKCURVIEW);
/* etc. */


But that requires several more calls to mouse.ChangeModeView...I hope this helps.
Title: Re: Animate Mouse on click only
Post by: Bad Voo-doo man on Thu 14/07/2005 23:03:03
Hey, thanks. I'll go give it a try and get back to ya