Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Tiki on Fri 07/05/2004 20:20:22

Title: Moving Ego Head
Post by: Tiki on Fri 07/05/2004 20:20:22
Is there anyway to make the ego's head follow the cursor while he's idle?  I suppose I could use regions, but that could get very complicated.  Are there any easier ways to do this?  Are there any at all?
Title: Re: Moving Ego Head
Post by: Ashen on Fri 07/05/2004 20:35:21
Something like:
if (character[EGO].view == IDLE-1) {
Ã,  FaceLocation (EGO, mouse.x, mouse.y);
}

in the repeatedly execute might do it, but I'm not sure if turning EGO would take him out of idle. If it does:

if ((character[EGO].walking == 0) && (character[EGO].animating == 0)) {
Ã,  FaceLocation (EGO, mouse.x, mouse.y);
}

might be better. Not had time to test these, but hope they help.
Title: Re: Moving Ego Head
Post by: Pumaman on Fri 07/05/2004 21:16:19
Yep, Ashen's suggestion looks good. I'd modify it slightly to cope with scrolling rooms:

if ((character[EGO].walking == 0) && (character[EGO].animating == 0)) {
  FaceLocation (EGO, mouse.x + GetViewportX(), mouse.y + GetViewportY());
}
Title: Re: Moving Ego Head
Post by: Hollister Man on Fri 07/05/2004 21:19:39
On the note of problems with it, maybe TikiTikiman wanted something to make him look up, diag, straight, down, at the camera, etc.  I think it could be done in the global script, by cutting the virtual screen into a grid of, lets say, nine squares.  When its directly over his head, he'll look up, etc.  Couldn't code it without the editor here, though. :)
Title: Re: Moving Ego Head
Post by: Ashen on Fri 07/05/2004 21:29:25
What if you create a view that includes diagonals, where only the face/head moves, then use:

if ((character[EGO].walking == 0) && (character[EGO].animating == 0)) {
  SetCharacterView (EGO, FACEVIEW);
  FaceLocation (EGO, mouse.x + GetViewportX(), mouse.y + GetViewportY());
}
else ReleaseCharacterView(EGO);

would that work? Or at least something like it.
Title: Re: Moving Ego Head
Post by: Tiki on Fri 07/05/2004 21:41:03
Thanks for the help.  Personally, I like Hollister Man's idea, but I might as well try the others before I get to crazy with the square grids.  Thanks again.