Walking issues

Started by Bartimaeus, Fri 10/06/2005 18:46:16

Previous topic - Next topic

Bartimaeus

Right,

I can't seem to get my character to walk-behind The objects on the screen. It is a platformed screen so the walkable area is basically only a line.
I know this is probably a stupid mistake but I went through the manual and looked at the tutorials and it all said the baseline should be at the bottom of the walk-behind, etc. I even tried putting the baseline on top but my character still just walks right past...

Okay here is my screen:



As you can see, the character only moves along a line (Only side walk-cycles)

For another technical question then:
Is it possible to make it so that just a click to the left or right will make the character move, even if its not right on the walkable area line.
Surely...

Okay, I did try to look this stuff up in the manual but I apologise if I've been dumbo and overlooked something obvious.

Cool...

~Billy

~The more adventures I go on, the more sand I get in my shoes

RickJ

Try moving the baseline down towards the bottomn of the screen one or more pixels.

Akumayo

Also, and a little off subject, check your walkable area and make sure its about 10 pixels thick, I think somewhere in the manual it specifies that the areas should be at least 8 pixels.  I could be wrong, but maybe that has something to do with it.
"Power is not a means - it is an end."

Bartimaeus

Yes but if you look at it, it's impossible for me to make the walkable area 8 pixels thick.

It can only be 1 or 2 max because the character has to walk along the top.
???
~The more adventures I go on, the more sand I get in my shoes

Ubel

It is recommended that the walkable area is 8-10 px thick but it's not a problem to have 1-2 px if you use lots of movecharacter commands in hotspots. It will of course be almost impossible to walk around with walk cursormode then.

ilSilente

#5
About the graphic:
If you use straight horizontal lines for walkable areas, you can made then 2 pixel tall.
Near the slope you need at least a 8-10px area, or your character will stuck.

Here a quick example (the walkable area is highlighted in green):


Then, here you can see walkbehind areas (in green, again):

See that the ground is also a highlighted to prevent the character appears over it (don't set a walkbehind area over the ground if you want to achieve a true platform appareance)

Next... let's script :)
Open the global script and edit:
Code: ags

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();
  }
}

This should prevent player character being stuck.

Scummbuddy

I'm pretty sure that the recommended width is 3 pixels wide.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Bartimaeus

#7
Okay ilSilente,

Thank youÃ,  Ã, muchÃ,  Ã, very!

All I did was just color the ground as well and set the baseline at the very bottom and now it works. The character still appears on top platform style.

I have a problem with the script though. It's picking up problems. Is this because I have an older of AGS? Must I update it?

Ps. My walkable area is 2 pixels and it works just fine with the exception of a few bumps.
~The more adventures I go on, the more sand I get in my shoes

ilSilente

#8
Quote from: Billy Gnome Jefferson on Sat 11/06/2005 09:32:10
I have a problem with the script though. It's picking up problems. Is this because I have an older of AGS? Must I update it?
Dunno... Do you get an error message?

Edit:
Oh right... it only works with AGS 2.7 or later due to object-oriented scripting. If you need non-OO script there are just few modifications to do (but I suggest you to backup your game and then upgrade).

Bartimaeus

#9
Great, thanks man!

It works like a charm. 

;D
~The more adventures I go on, the more sand I get in my shoes

SMF spam blocked by CleanTalk