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 / The Power of SetSpriteDepth

Author
Message
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 4th May 2012 23:56
Because of the way sprite priority redraw works, for my new project I started using different sprite depth levels to create different effects. I have around 18 different sprite depths and switch sprites from one depth to the other according to the game logic.

What is the impact of SetSpriteDepth() in terms of speed? Is it a speed-friendly command to use in the main game loop, or is it something to use with caution like CopyImage ?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th May 2012 01:58
It is certainly not as bad as CopyImage, but it does force a re-sort of that sprite into the render list, which is ordered by depth. If you had thousands of sprites, and they were all changing depth, you may notice it, but it's not something I've benchmarked.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th May 2012 09:17
ok thanks, i will try to keep its use at a minimum

Login to post a reply

Server time is: 2024-05-02 03:44:57
Your offset time is: 2024-05-02 03:44:57