Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Sprite Drawing Sequence

Author
Message
Poggy
19
Years of Service
User Offline
Joined: 6th Apr 2007
Location:
Posted: 11th Apr 2007 05:13
Can anyone tell me why, when i am trying to draw a sprite that overlaps another one, it sometimes appears in front of the other as it should, but sometinmes gets drawn behind it. I had assumed that a sprite drawn after another would always appear to be in front of it if it overlapped.

Any advice woud be appreciated.

Mike
wildbill
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 11th Apr 2007 21:06
The Set Sprite Priority command may help you.
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Apr 2007 02:52 Edited at: 12th Apr 2007 21:55
@ Poggy

This particular board does not reference the fact that when posting you should declare whether you are using DBC or DBP. You should always do that when posting in this forum. The answer depends upon the version used in many cases and people's time will get wasted unnecessarily.

wildbill's suggestion should work if you are using DBP.

If you are using DBC, my understanding is that DBC will draw sprites based upon the number of the image used. For example, a sprite drawn with image 1 will be drawn before a sprite drawn with image 112.

** [EDIT] ** The sprite number is used by DBC to determine sprite priority when drawing. Please see the post below.

LB
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 12th Apr 2007 05:17
DB classic draws sprites (from memory) in reverse order to creation.

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Apr 2007 06:23
Sorry, I made an incorrect statement in my earlier post. It is not the sprite image that DBC uses, but the sprite number itself that DBC uses to place them on the screen in order, starting at the lowest number.

I wrote a short program to test this. The order of creation did not matter, but the sprite number did. Sprite #1 was always drawn first, whereas sprite #2 was next and so on and so forth. I specifically drew sprites with higher #'s first to see what it would do, but it did not matter, the lower sprite numbers always were overwritten by sprites with higher numbers.

Here's the code to demonstrate:



LB
LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Apr 2007 16:22 Edited at: 12th Apr 2007 21:56
@ Poggy

Sorry for the confusion.

LB

Login to post a reply

Server time is: 2026-07-05 12:17:31
Your offset time is: 2026-07-05 12:17:31