How do characters know when they are behind something?

Non-platform specific questions.

How do characters know when they are behind something?

Postby IPete2 » Sat Mar 05, 2005 11:35 pm

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.
IPete2
 
Posts: 43
Joined: Sun Jan 30, 2005 4:06 pm
Score: 0 Give a positive score

Aha! Sorted!

Postby IPete2 » Sat Mar 05, 2005 11:55 pm

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.
IPete2
 
Posts: 43
Joined: Sun Jan 30, 2005 4:06 pm
Score: 0 Give a positive score

Postby ingsan » Sun Mar 06, 2005 7:32 pm

Oh ! Great ! I was looking for the same solution.
Thanks Pete :o
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby IPete2 » Sun Mar 06, 2005 10:51 pm

Ingsan,

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

IPete2.
IPete2
 
Posts: 43
Joined: Sun Jan 30, 2005 4:06 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest