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.

Author
Message
ZestyPro
14
Years of Service
User Offline
Joined: 27th Aug 2011
Location: The Grid
Posted: 9th Oct 2011 21:18
I'm trying to get a sprite to be in front of another sprite. how do you do this?

i like cheese pizza. do you like cheese pizza?
noobnerd
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 9th Oct 2011 21:36
use the " set sprite priority " command

the command will set the sprite draw order meaning that if you have sprites a,b and c
¨writing this :

set sprite priority a,1
set sprite priority b,2
set sprite priority c,3

will result in a being drawn first ( lowest )
c will be drawn last.

this means that sprite c will be on top
ZestyPro
14
Years of Service
User Offline
Joined: 27th Aug 2011
Location: The Grid
Posted: 9th Oct 2011 21:52
yes!!! it worked!!!! thank you!!

i like cheese pizza. do you like cheese pizza?
noobnerd
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 10th Oct 2011 01:20
my pleasure
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Oct 2011 02:53
If you want to avoid the hassle of changing the priority of all your sprites you can do it the natural way without the SET SPRITE PRIORITY command.

The way Darkbasic Pro is right now sprites are drawn based on the image number used in the sprite. Sprites that use image number 1 are always under sprites that use image number 2 and so on.

In the following code snip all the sprites use random numbers between 1 and 999 while the sprite at the mouse coordinates use sprite number 1000. All sprites use image numbers 1 to 17. Hit the mouse button to change the image number used on the mouse sprite and move the mouse around the sprites on the screen. It'll be under/over each sprite based on the current image number of sprite 1000.



ZestyPro
14
Years of Service
User Offline
Joined: 27th Aug 2011
Location: The Grid
Posted: 11th Oct 2011 01:30
i see. tank you!

i like cheese pizza. do you like cheese pizza?

Login to post a reply

Server time is: 2026-07-10 06:07:50
Your offset time is: 2026-07-10 06:07:50