Walking script -- A better method?

Started by monkey0506, Sun 09/01/2005 22:11:37

Previous topic - Next topic

monkey0506

I noticed that when the player was walking, if the user clicked the mouse, the player paused for a moment, and his walking view started over. That is because in on_mouse_click I had:

Code: ags
// on_mouse_click
// button == LEFT
ProcessClick(mouse.x, mouse.y, mode);
// stuff


So, it was re-processing the click. I changed the code to this:

Code: ags
// on_mouse_click
// button == LEFT
  if ((character[GetPlayerCharacter()].walking) && (GetCursorMode() == walk)) {}
  else ProcessClick(mouse.x, mouse.y, mode);
// stuff


That way, it would only process the mouse click if the player wasn't already walking and the cursor mode was walk. Otherwise, process the click as normal. This script worked, somewhat, but the player animation still shows a skip or something. It appears that when I click the mouse (and the cursor mode is walk and the player is walking), that the player is set back to the first frame in the view. Is there a different way of doing this so that the player's walking view runs smoothly?

strazer

QuoteIt appears that when I click the mouse (and the cursor mode is walk and the player is walking), that the player is set back to the first frame in the view.

Doesn't happen here (v2.62) with
  ProcessClick(mouse.x, mouse.y, GetCursorMode());
There's a very short pause while the pathfinder calculates the new path, but the last frame is retained.

Are you sure you aren't stopping the character beforehand or releasing/re-setting his view somewhere in there?

monkey0506

Holy crap. I really messed up my global script. :o I don't know what the heck I did but it's really messed up. I'll get back to you if I'm still having problems when I get this figured out.

SMF spam blocked by CleanTalk