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:
(http://img.photobucket.com/albums/v206/gaddit/Walk-BehindsandBaselines.png)
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
Try moving the baseline down towards the bottomn of the screen one or more pixels.
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.
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.
???
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.
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):
(http://quellaradioli.altervista.org/luca/walkareas.gif)
Then, here you can see walkbehind areas (in green, again):
(http://quellaradioli.altervista.org/luca/walkbeh.gif)
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:
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.
I'm pretty sure that the recommended width is 3 pixels wide.
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.
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).
Great, thanks man!
It works like a charm.
;D