The Daily Click ::. Forums ::. Klik Coding Help ::. Bring to front! Bring to back!
 

Post Reply  Post Oekaki 
 

Posted By Message

en kerro



Registered
  21/10/2004
Points
  578
30th January, 2006 at 20:16:25 -

I have big problem with bring to front and bring to back events.. I try to explain it:
Objects:
Player
Tree (active object)
Detector
player's shadow

Events
Blue detector is supposed to be invisible.
Shadow has 8 directions movement, player's position is always 0x,-40y from shadow.
If player's shadow collides with tree detector, it stops (shadow can't overlap detector)

And the main thing, where is the problem:

y of player shadow is bigger than y of tree=> bring tree to back
y of player shadow is smaller than y of tree=> bring tree to front

And so, player can go behind the tree and can be in front of it.
It works with ONE tree...
BUT if I add more of them, it will go crap.
I know where's the problem because event effects to every tree. But how to get it so it would effect only in one tree. One way is to add dozens of tree objects (like tree 1, tree 2, tree 3...) But I know it's not the best idea.
Any help?
Image

 
Current Projects:
The Artillerys 10%
Forgotten Legends 8%
Earth Defender 20%

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
30th January, 2006 at 21:24:30 -

Try changing the "subject" of the event to the tree instead of the player - i.e. if Tree's Y position is greater than that of Player Shadow, bring it to the front, rather than the other way round. If that doesn't work, spreading values would be the way to go.

 
http://www.davidn.co.nr - Games, music, living in America

en kerro



Registered
  21/10/2004
Points
  578
2nd January, 2006 at 12:55:53 -

It works now!! Tanks wong!

 
Current Projects:
The Artillerys 10%
Forgotten Legends 8%
Earth Defender 20%
   

Post Reply



 



Advertisement

Worth A Click