I have a non tile rpg, and how do I make it so when I walk past a tree i become under it.
This is what I did. (Note: the origonal depth of the player is 200 and the tree is 199)
code:
onClipEvent (enterFrame) {
if (_parent._parent.player._y<=this._y) {
if (undertree<>true) {
undertree = true;
_parent._parent.tree01.swapDepths(_parent._parent. player);
}
}
if (_parent._parent.player._y>=this._y+0.0001) {
if (undertree == true) {
undertree = false;
_parent._parent.tree01.swapDepths(_parent._parent. player);
}
}
}
It works, exaclty how I want it to (Fyi, that code is on a movieclip that is inside the tree movieclip), but if I add more movie clips that overlap then im sure it will mess up. Say there is a bird in the tree and it is always sapoosed to be above, well if the player passes the tree it will be under.
Altho that statment may not be ture, it will be true in other cases.
Any ideas?
I Use Flash 8
Help is my last name, Freeload is my first :P إŦ№إ Mя. Åŋdëŗ§ǿņ
hmm, it might work. But wont bmp make my game larger?
Also i haven't worked with bmp and as2 together -.- and I have
no clue about the first thing of his code, and all of his examples are gone.
There has to be an esier way...
Maybe if I were to set all the depths when you go under a tree, etc...
Altho that would result in a much larger code.
Last edited by --eXe-eXtreme--; 04-09-2006 at 11:00 AM.
I Use Flash 8
Help is my last name, Freeload is my first :P إŦ№إ Mя. Åŋdëŗ§ǿņ
Well yeah that could work and it could help in map building too. If you stored all the trees positions in an array. You would have to access there positions on a constant basis to check wether you are behind or in front. When you store the depths i suggest you have a decent space of 5 between depths so you dont need to actually swap the depths of the trees, just place the character in the depth space between trees. It actually shouldnt be that hard at all to do.
Let me know what you come up with.
"I layed down in my bed last night looked up at the stars, and thought to myself... Where the F*#K is my roof"
That might work but I will have to be very carfull with the order of the trees (Not like it will just be trees tho), But I will see if I cant get a demo done this week.
I Use Flash 8
Help is my last name, Freeload is my first :P إŦ№إ Mя. Åŋdëŗ§ǿņ
Whe you start out you wan walk under the tree but you never become over the tree.
So, I would have to manualy put that in. Is this way only usefull for objects the user never walks over or under?
I Use Flash 8
Help is my last name, Freeload is my first :P إŦ№إ Mя. Åŋdëŗ§ǿņ
how have your objects been placed relative to their origin. My code works when the clip is placed in the center-bottom origin, not center-center origin.