Page 1 of 1

How do characters know when they are behind something?

PostPosted: Sat Mar 05, 2005 11:35 pm
by IPete2
HIya,

Can anyone plz help?

I have a lot of trees in a 3/4 view top down test. Trees are all one object (which is where I think I am going wrong.)

I would like to be able to script a function to test which object should be drawn above which, i.e. my character should walk in front of trees if he is below them in y position on the game screen and behind the tress if he is above them on the screen.

I have tried using yscreen comparisons and trying to swap zdepth on the fly but I have not succeded. Please can anyone help?

Thanks

IPete2.

Aha! Sorted!

PostPosted: Sat Mar 05, 2005 11:55 pm
by IPete2
Here's what I did.

I separated the trees into individual actors. Then placed this collision code on them.


if (y >MainChar.y)
{
ChangeZDepth("tree", 0.80);
}

if (y<MainChar.y)
{
ChangeZDepth("tree", 0.1000);
}



Works a treat!

:)

IPete2.

PostPosted: Sun Mar 06, 2005 7:32 pm
by ingsan
Oh ! Great ! I was looking for the same solution.
Thanks Pete :o

PostPosted: Sun Mar 06, 2005 10:51 pm
by IPete2
Ingsan,

Wow, I'm glad to be able to actually give something back to this forum, I have learned a lot since Feb.

IPete2.