Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alen101 on Fri 04/03/2016 23:13:01

Title: change cursor graphic for short period of time
Post by: Alen101 on Fri 04/03/2016 23:13:01
Is there a not compicated way to make my cursor change for a second and then to comeback to my original cursor image?
my mouse is an aim and i am shooting,
I have an aim draw on the cursor and i want to add a spark when i shoot (when i press the mouse button)
ive been looking at the posts, but it gets far too complicated to the point i am now at scripting.

Any help wold be great!
Thanks!!!
Title: Re: change cursor graphic for short period of time
Post by: Slasher on Sat 05/03/2016 08:15:00
assuming its an inv item used for the crossfire (or whatever)

eg
Code (ags) Select
mouse.ChangeModeGraphic(4, 2057); // number of cursor mode (4= Use inv) and graphic to use. Then just switch back afterwards.

something like this...

Title: Re: change cursor graphic for short period of time
Post by: Khris on Sun 06/03/2016 23:28:51
Or use the actual name:

  mouse.ChangeModeGraphic(eModeUseinv, 2057);
  // or
  mouse.ChangeModeGraphic(mouse.Mode, 2057); // change current mode's graphic


Then call Wait(3) which will show the changed cursor for 3/40th of a second. Then change it back.
You can also set a timer and change it back in repeatedly_execute.
Title: Re: change cursor graphic for short period of time
Post by: Vincent on Wed 09/03/2016 00:51:07
I think you can do it in several ways..
For example, let's say that the pointer is an object.

Code (ags) Select

function repeatedly_execute()
{
  if (Object.GetAtScreenXY(211, 145) == oRock) // and mouse button is pressed
  {
    mouse.SaveCursorUntilItLeaves();
    mouse.Mode = eModeTalk;
  }
}


I think that Mouse.SaveCursorUntilItLeaves() maybe it could be useful in this case..
This allows you to temporarily change the mouse cursor when the mouse moves over a hotspot, object or character and have it automatically change back to the old cursor when the player moves the mouse away.