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.

DarkBASIC Discussion / Sprite Behind the other Sprite?

Author
Message
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 15th Jan 2008 13:32
Ok, when I select new and click the food bowl the object menu comes up, and the "feed" button is underneath the sprite when it should be in front of it. However, when I go into testing mode, I click on it and the feed button is infront of the sprite. How can I fix it so people can play it in a new game with the feed button infront of the object menu?

Code,




Formerely Cool Guy Jordan
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Jan 2008 15:46
The last sprite to be created is on top. Just make sure you use the Sprite commands in the right order.

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Jan 2008 17:19
This is problem that has plagued me in the past.
The sprite order is fixed, you cannot change the order they are drawn to screen. What you can do is paste them to screen in the order you want. This is very useful if you have a 2D game where you need an object to go behind and in front of objects. I made a 2D gangster game but gave up because I had people that were behind me walking on my face!


Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 15th Jan 2008 18:02
Thank OBese87! Like your new title on the Breeder's Life thread?


Formerely Cool Guy Jordan
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Jan 2008 18:15 Edited at: 15th Jan 2008 18:19
Lol!

I answer the question, then someone else posts after me with incorrect information and you ignore my post and thank them!

Quote: "The sprite order is fixed, you cannot change the order they are drawn to screen"


It's a good job I'm not easily upset isn't it!

Anyway, this code snippet might make things a little clearer...



TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Jan 2008 18:55
@TDK
What I said is correct.
Your code snippet doesn't change the order of the sprites, it substitutes positions and images between the sprites to make it appear that they have been switched, the sprites themselves don't change order.
You even state this yourself
Quote: "The last sprite to be created is on top. Just make sure you use the Sprite commands in the right order."


I think we are both saying the same thing, I just have a different approach to solving the problem. Your method probably works best with a lot of sprites but I think mine is simpler

@Zeus
thanks but I don't think I am a co-programmer
I could be if you wanted though, I've been looking for a project to get into

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Jan 2008 19:06
You said:

"you cannot change the order they are drawn to screen"

I read that to mean that you couldn't achieve the same effect without using Paste Sprite.

Quote: "I think we are both saying the same thing, I just have a different approach to solving the problem"


After re-reading your post I agree!

I wasn't concentrating enough on your post because I was thinking more about being dissed by Zeus!

TDK_Man

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 15th Jan 2008 19:22
Quote: "Lol!

I answer the question, then someone else posts after me with incorrect information and you ignore my post and thank them!


Quote: "The sprite order is fixed, you cannot change the order they are drawn to screen"

It's a good job I'm not easily upset isn't it!

Anyway, this code snippet might make things a little clearer..."


Oops! Thanks TDK. I am so sorry I didn't see your post!

@OBese87: I'll e-mail you.


Formerely Cool Guy Jordan

Login to post a reply

Server time is: 2025-06-02 09:59:32
Your offset time is: 2025-06-02 09:59:32