Character gets stuck in certain areas

Started by , Mon 09/01/2006 05:35:29

Previous topic - Next topic

Dimithio

I've searched the forums and havent found what I'm really needing.Ã,  Since AGS is so new to me, I decided to make a remake on Monkey Island 2: LeChucks Revenge to sort of get the hang of how it works.Ã,  Anyways, I'm encountering a problem with a few areas in the town of Woodtick...here's a ss of my walkable areas.Ã, 


Woodtick


For some reason, Guybursh will get stuck in various areas of the town (2 that I know of for certain).Ã,  I realize my walkable areas arent very large (and I really can't make them any bigger)...is there anyway I can get around this? I saw this script earlier (see below), but it wouldnt load...would this help or does one have a better solution? Thanks in advance!

function on_mouse_click(MouseButton button) {
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  if (IsGamePaused() == 1) {
Ã,  Ã,  // Game is paused, so do nothing (ie. don't allow mouse click)
Ã,  }
Ã,  else if (button == eMouseLeft) {
Ã,  Ã,  if (mouse.Mode == eModeWalkto)
Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  if (GetWalkableAreaAt(mouse.x,Ã,  mouse.y) > 0)
Ã,  Ã,  Ã,  Ã,  Ã,  ProcessClick(mouse.x, mouse.y, eModeWalkto);
Ã,  Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  /* Look for walkable area */
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  int i, wa, x;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  iÃ,  = 0;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  x = mouse.x;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  wa = GetWalkableAreaAt(character[Player.ID].x,Ã,  character[Player.ID].y);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  while ((i <= game.room_height) && (GetWalkableAreaAt(x, i) != wa)) i++;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  /* End look for w.a. */
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (i <= game.room_height) ProcessClick(mouse.x, i, eModeWalkto);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  /* Note: doesn't do nothing if no walkable area is found on the screen column where the player clicked */
Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  }
Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  ProcessClick(mouse.x,Ã,  mouse.y, mouse.Mode);Ã,  Ã, 
Ã,  }
Ã,  else {Ã,  Ã, // right-click, so cycle cursor
Ã,  Ã,  mouse.SelectNextMode();
Ã,  }
}

Gilbert

What's the walking speed of the character?
If a character is walking in some fast speed while the walkable areas are not wild enough (compared to the character's speed) it's possible the path finder couldn't ensure that he walks on accurate spots, so there're some small chance that he'll walk into some non-walkable coordinates.

I also see that in your areas there're at least some unfilled pixel "holes" (which yields very narrow areas, see red circled parts of this) and some lone pixel that might cause problem (green circle), you may also try fixing them first.

Dimithio

Thanks for your input Gilbot.  The character's walking speed was 5.  I changed it to 3 and had a lot less incidents.    Thanks for pointing out the holes as well.  I think the best thing to do is edit the areas in MS PAINT and then import them as masks.  It's way too hard to draw on such a little screen.

Gilbert

Yeah right, there're only limited functionality in the area painter of the editor.

SMF spam blocked by CleanTalk