-
multi-character z sorting / swapdepths on Y position
hi could someone point me to explanation on how to implement z sorting on multiple characters based on their Y position.
presumably if 2 characters are at the same Y position, then the one shown in front of the other could be the last that moved.
here is what i would be applying it to:
http://www.interference.co.uk/test/southpark/index.htm
i've done a search of swapdepths on the board and there's about 500 articles so i'm not sure where to start.
thanks
j
-
if you have duplicated the movieclip, then you also set the depth of the movieclip. the higher the depth, the further in front it is. you can also use the swapDepth(); doce to change the depth of a movieclip. if you want to make something seem three dimenrional and you have made a floor in your movie which goes backwards into the horizon (not only a line) then you can make characters seem further behind some others by getting their _y position and using it to set their depth. you can also use the _y position to set the characters size. i hope i answered your question.
-
Re: multi-character z sorting / swapdepths on Y position
ahahahahahah
however can't you remove that white outline around the char?
...just to be perfectionist :P
-
w00t
Z sorting as per _y coordinate..
Say you have a screen size of 400 x 600..
to get ones depth depending on an x,y coordinate:
width = 400;
height = 600;
this.swapDepth(this._y*width+this._x);
-
ism
wouldn't your calculation produce a number > 16000 odd which is the maximum number for flash when using swapdepth?
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
w00t
Swapdepths works higher than that that, its somewhere closer to 1.6 million..
-
ʞ33ƃ
with characters like that the _y is all that matters for swap depth.. I give each character an ID
So
character1.id=1
character2.id=2
character3.id=3
charater1.swapDepth(_y*1000+character1.id)
charater2.swapDepth(_y*1000+character2.id)
charater3.swapDepth(_y*1000+character3.id)
The id make sure 2 characters will never have the same depth. but it also means if character 1 and 3 have the same _y then character 3 will always be on top.
Nugget
-
w00t
That also works, but it means that each object requires more overhead, well actually, it is basically the same way I said, however there is no _x sorting
-
>> white outline
its a bitmap i pasted in, eventually it would be vectors
>>to get ones depth depending on an x,y coordinate:
i believe the x coordinate is irrelevant in this case
>> charater1.swapDepth(_y*1000+character1.id)
is it possible i can avoid running swapDepths on *all* characters when a character moves. is it safe to only do it on a character who changes position?
thanks all
j.
-
w00t
yes. the use of nuggets method and mine is much of a sameness, they do the exact same thing, however his keeps track of a depth variable.
-
ʞ33ƃ
Pred the 1 bug with yours is if 2 people have the same x and y. they theyll have the same depth wich flash won't let you do (maybe different in mx, not sure). I know like in flash 5 one of the objects would basically disapear..
-
ʞ33ƃ
and yes you only need to run swapDepth on the character being moved.
-
w00t
And the one bug with your is if there is more than 1000 objects >=)
Omg.. its 6am in the morning.. im about to die.
-
ʞ33ƃ
-
Illuminatus!
well you could set a depth for all the characters, then just swap numbers.
swapDepths(5) if another south park character is '4'.
i like the game btw
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|