- Loop through the list of objects onscreen.
- At each object quickly loop through all other objects and check for overlaps (2D overlap with actual sprite, not a 3D collision) with surrounding objects.
- If there is an overlap with an object then check to see if this object is in front of current object about to be drawn.
- If overlapping object is in front then cut out section of overlapping objects sprite that actually overlaps our object's sprite and draw it over the top.
- Repeat for all overlapping objects and when finished move onto next object.
Thursday, 5 February 2009
Getting there
Finally got the chance to squash this bug and so far it's looking hopeful. In fact, the redesign has meant that I may be able to speed the draw code up. The reason for this is that I was forced to find a way of preventing objects competing for the front of the queue. It only happens in certain circumstances but is a major problem if I'm to retain the freedom offered by unusual dimensions and locations for any object. If for example only 3 objects are on screen but object1 should appear in front of object 2 and object 2 should appear in front of object 3 and object 3 should appear in front of object 1 it causes one of the objects to pop out from behind an object that is supposedly obscuring it Scroll down to "Big Mistake" post to see a screenshot of the bug in action. The solution which means hopefully faster redraw is as follows:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment