Face direction problem (SOLVED).

Started by RetroJay, Wed 02/04/2008 02:15:43

Previous topic - Next topic

RetroJay

AAAAaaaarrrrgh!!
Please help me!
I have a room with two doors facing you on the back wall. Now what I want to do is to have the character facing forward and standing infront of whatever one he has come through when he enters this room.
The standing infront of either door when he enters this room is not a prob.
It's the facing forward part that I just cannot get to work. I'm trying to do this within "Player enters room before fadein".
I've been trying for the last couple of days with no success. I am all out of ideas.

I just know I,m gonna kick myself when I find out how easy it is.
Thanks in advance.
Jay.

Gilbert

What did you put in the script?

To face forward you may use something like:

player.FaceLocation(player.x, player.y + 100);

RetroJay

Hey Gilbot!
Took a while getting back cos I was kicking myself black n blue. ;)
That works a treat for the two doors. BUT I should have mentioned this before. There are actualy 3 doors in total the third being the one you
originally enter this room through which is on the right wall.
When he enters through THIS one I really wanted him to automatically walk left slightly into the room and stay facing left.
With your bit of script that I placed into "Player enters room before fadein" he now faces forwards when entering through all the doors in this room. Is there a way to make him face left when entering from the right door but facing forwards when entering from the 2 top doors.
Sorry to be a pain in the ass. ;D

Thanks for the help. BTW what does the 100 in that script do?

Gilbert

If you need to have different behaviour depending on which door he's from you may make use of variables to track it.
However, by entering from different doors I suppose that means he's entering from different rooms, right? In that case there's a simpler method, which is to check the last room he's in, something like:
Code: ags

if (player.PreviousRoom == 4) {
    //blah bla bla
} else {
   // blaaaaah
}


The 100 has no real meaning, you can just put in other positive numbers, like 10, 50, or even 1000. That facelocation line just tells the character to face the point with coordinates:
(player.x, player.y + 100)
which is a point directly below the character's current position, so he will face "down".

RetroJay

#4
Horray for Gilbot!! ;D
Absolutely bloody fantastic.
Thankyou ever so much it works pefectly. Using your script in "Player enters room before fadein" I put this:-

Code.

  // script for Room: Player enters room (before fadein)
if (player.PreviousRoom == 1) {
return;
}
else {
player.FaceLocation(player.x, player.y + 100);
}

Where return is I will put some more code in there later to make him walk (automatically) further into the room and maybe some dialog.
Once again Thankyou.

Jay.

SMF spam blocked by CleanTalk