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! / Drawing layers

Author
Message
Goos
16
Years of Service
User Offline
Joined: 7th Aug 2008
Location:
Posted: 10th Jun 2019 12:32
How do I draw lines behind sprites. If I draw the lines first then the sprites , the lines are drawn over the sprites not under the sprites.

Thanks,

Goos
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 13th Jun 2019 13:25
You didn't say which software you are using. If it is AppGameKit, I can't help you. If it is DBP, then all you need to do is code the line DRAW SPRITES LAST early in your program.



So many games to code.....so little time.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Jun 2019 18:23 Edited at: 14th Jun 2019 18:27
assuming AppGameKit, using Render() after you draw the lines in your loop should do what you need; i see no noticeable performance hit with this method.

if your order of creation (lines vs sprites) might be "mixed", meaning you might draw a line, create a sprite, draw a line, etc., then consider "drawing" to a sprite. (i'm not sure that this is necessary but expect it might be for "mixed" usage as i've described).

IE, look at SetRenderToImage() and use that image to draw lines to. have a "back layer" sprite (with a depth > than all your normal sprites) using that renderimage. when you're done drawing lines, go back to SetRenderToScreen().
this method will cause a performance hit (that may be acceptable to you).



hope that helps

Login to post a reply

Server time is: 2024-11-17 22:27:35
Your offset time is: 2024-11-17 22:27:35