Strange drawing bug

9 views
Skip to first unread message

Joseph Marlin

unread,
Dec 19, 2011, 9:21:15 PM12/19/11
to cocos-...@googlegroups.com

I decided to make a nice isometric viewer. I am getting a strange issue where two cubes, always exactly two cubes, are not being drawn correctly. I cannot tell why, and I cannot tell if this is a bug with cocos, a bug with python, an error with my code, or intended behavior. Are all elements in a layer guaranteed to be drawn in the order they are added? 

Here is an image of the problem:

If you want to give it a run through, here is the image I used:


Thanks so much to anyone who could give me a hand with this!

Richard Jones

unread,
Dec 19, 2011, 10:17:54 PM12/19/11
to cocos-...@googlegroups.com
On 20 December 2011 13:21, Joseph Marlin <joseph....@gmail.com> wrote:
> I decided to make a nice isometric viewer. I am getting a strange issue
> where two cubes, always exactly two cubes, are not being drawn correctly. I
> cannot tell why, and I cannot tell if this is a bug with cocos, a bug with
> python, an error with my code, or intended behavior. Are all elements in a
> layer guaranteed to be drawn in the order they are added?

No, they're not. To guarantee drawing order you should set z value
when you add the sprite to the layer.


Richard

Joseph Marlin

unread,
Dec 19, 2011, 10:31:01 PM12/19/11
to cocos-...@googlegroups.com
Ok, thanks! Does that add a significant amount of overhead?


--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.
To post to this group, send email to cocos-...@googlegroups.com.
To unsubscribe from this group, send email to cocos-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.


Richard Jones

unread,
Dec 19, 2011, 10:39:36 PM12/19/11
to cocos-...@googlegroups.com
On 20 December 2011 14:31, Joseph Marlin <jm9...@desales.edu> wrote:
> Ok, thanks! Does that add a significant amount of overhead?

No, it just controls the ordering of the elements in the layer when
they're added.

Joseph Marlin

unread,
Dec 19, 2011, 10:40:24 PM12/19/11
to cocos-...@googlegroups.com
Interesting. Ok, well thanks so much for your help.

Reply all
Reply to author
Forward
0 new messages