Adam's Lair Forum

game development and casual madness
It is currently 2018/04/25, 07:11

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Order of drawing sprites
PostPosted: 2017/08/13, 16:37 
Newbie
Newbie

Joined: 2017/08/13, 16:30
Posts: 5
Role: Hobbyist
How do I specify the order of how sprites are drawn? If two sprites are at the same spot, how do I know which are drawn on top?

The issue I'm having is that I have a space background texture which is drawn over the entire screen, but when I add my ship sprite it's not visible. It's there, but underneath the background. If I disable the background game object the ship pops up.

I come from Unity, and there you had SortingLayers and OrderInLayer properties. Are there any similar features in Duality?

Hoping for help!


Top
 Profile  
 
PostPosted: 2017/08/13, 17:31 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2042
Location: Germany
Role: Professional
Hey there and welcome!

In Duality, when two sprites are at the exact same spot, their drawing order is stable at runtime, but not defined one way or another. You can change this by giving either of the sprites a depth / Z offset using the offset property in the SpriteRenderer component.

Alternatively, in case of an object that truly is in the background, it would also make a lot of sense to use its Z coordinate in transform to move it away from the camera. Note that the parallax effect you'll get in that case can be countered by scaling up the object, or by setting the cameras perspective rendering mode from parallax to flat.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
PostPosted: 2017/08/13, 21:06 
Newbie
Newbie

Joined: 2017/08/13, 16:30
Posts: 5
Role: Hobbyist
Ahh, thanks! SpriteRenderer offset did the trick.

I'm just starting out with Duality and so far I like it alot. Much more light-weight than Unity, which I appreciate. And since I'm only doing simple 2D-games I think Duality will be better for me. I miss a few neat features from the Unity-editor though, but hey, one can't have it all. ^^


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group