Is there a way to set a z-order of the graphic objects drawn to the screen?
I’m running into a problem where when I draw “sprite A” to the screen at lets say y=250 and “sprite B” at y=200, when sprite B moves on the x axis it looks like it’s walking on top of sprite A’s head.
Is it performant to reinsert objects whenever a new object is created? I have about 20 sprites at any given time.
Also, what happens to the objects that are already drawn to the screen when a reinsert occurs? Do they temporarily disappear?
4 sprites are drawn to the screen (z-index works great ), which can be represented as:
[sprite1][z-index=1]
[sprite2][z-index=2]
[sprite3][z-index=3]
[sprite4][z-index=4]
Then when other sprites are created, the order becomes as follows and the problem begins:
[sprite5][z-index=5] | [sprite1][z-index=1]
[sprite6][z-index=6] | [sprite2][z-index=2]
[sprite7][z-index=7] | [sprite3][z-index=3]
[sprite8][z-index=8] | [sprite4][z-index=4]
Reinserting the elements to the group works great when there are always a certain number of elements on the screen, but in my case where objects are drawn dynamically it gets a bit tricky and I don’t really have a clue on how to fix this, so any ideas would be kindly appreciated.
Thanks in advance. [import]uid: 8446 topic_id: 3501 reply_id: 10564[/import]