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.

Dark GDK / draw certain sprites first or how to put a 3D object over a 2D sprite

Author
Message
xbruceleex
14
Years of Service
User Offline
Joined: 16th Feb 2010
Location:
Posted: 16th Feb 2010 22:53
I know there is dbDrawSpritesFirst() and dbDrawToBack() but these functions result that my sprites will not be displayed at all. and i want only certain sprites to be drawn first. the rest should be drawn last.
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 17th Feb 2010 09:10
dbSetSpritePriority

This command will set the relative priority of the specified sprite. All sprites start with a value of zero giving them equal chance of being drawn last. By setting a single sprite a value of one will cause that sprite to be drawn last. You can specify a unique priority value for each sprite creating an order of drawing for every sprite in your program.

Syntax
void dbSetSpritePriority ( int iSprite, int iPriority )

xbruceleex
14
Years of Service
User Offline
Joined: 16th Feb 2010
Location:
Posted: 17th Feb 2010 11:59
ok but i want my 3d object over a certain sprite. the other sprite should be over any 3d objects
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 17th Feb 2010 13:45
If you want to put a 3D object above a sprite, then switch off the camera background colour with dbBackdropOff, because the 3D background colour will overwrite everything and hide the sprite.

If you use dbDrawSpritesFirst() then all sprites displayed with dbSprite will be under the 3D objects. If you want certain sprites to be under the 3D and some above, you can try to hide those sprites that should be on top and then draw them with dbPasteSprite, after the 3D rendering, at the end of the main loop.
xbruceleex
14
Years of Service
User Offline
Joined: 16th Feb 2010
Location:
Posted: 17th Feb 2010 16:55
the pasteSprite functiojn is somehow like a dbDrawSpritesLast funtion only for certain sprites. for my sprites that should be above any 3d, it is a good solution. Somehow, it doesn't matter where i put that function. i even put it at the beginning of the main loop at it displays the sprites over any 3d

but my other problems are the sprites that are drawn first before any 3d. i have two big world objects and one little object(the player) which would be drawn last. i wanted that these certain sprites are under the player but are above these two big objects

maybe i have to create a 3d object that should be under the playerobject. but then i have a problem with sprite animations
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 18th Feb 2010 11:24
You mean 3D object - sprite - 3D object? I'm sure that won't work. In that case your best bet is, as you said yourself, to texture a 3D plane with the sprite image, so you can insert it into the 3D rendering order. You can handle the animation by changing the texture coordinates with a timer, it shouldn't be very difficult.

Login to post a reply

Server time is: 2024-10-02 01:29:59
Your offset time is: 2024-10-02 01:29:59