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.

AppGameKit Classic Chat / DrawSprite and SetSpriteDepth problem

Author
Message
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 8th Nov 2013 10:21
Hi all,
I'm trying to draw a sprite, using DrawSprite command, over other sprites and backgrounds. To do that I'm setting the sprite depth using SetSpriteDepth command before drawing the sprite but it appears under other sprites, It seems to ignore the SetSpriteDepth command.
Am I doing something wrong or DrawSprite isn't affected by SetSpriteDepth command? In the help files there isn't any reference at all.

Thanks in advance.
Regards!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Nov 2013 10:39
It could be that your drawing your sprite, but then the SYNC is over-writing it with the rest of the sprites. Like, when you draw the sprite, it draws it straight to the back buffer, regardless of depth, because in this case it's depth is considered 1, as it's being drawn manually. But then the other sprites are being drawn onto the backbuffer, on top of your sprite.

I think you need to do some experiments with the manual sync stuff, like update(), update2d(), swap() etc etc because you'll need to break SYNC down into it's component parts, then find the right time to draw your sprite so that it appears on top of everything else.

I am the one who knocks...
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Nov 2013 16:22
And are you sure that the depths of the other sprites is greater than the one you are manually setting? I think the default depth is 10.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 8th Nov 2013 20:27
Thank you for your answers!
@AL: yes, I'm using a depth for the drawn sprites less than "normal" sprite's depth...
@Van B: I've test to change sync() for update2d(1/60); render(); draw all my sprites with drawsprite() and swap() and it now works!

Thank you!!!

Login to post a reply

Server time is: 2024-11-24 21:47:28
Your offset time is: 2024-11-24 21:47:28