Jump to content
  • Advertisement
Sign in to follow this  
Honchkrow

[GMS] Need help with overlapping sprites

This topic is 995 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

(Keep in mind i'm pretty new to GMS still so forgive if i don't understand a few things about it)

 

So i was testing a few mechanics in GMS and one of the things i was were two sprites in the same x/y coordinate and moving independently of eachother (the bottom sprite moves in the direction of the WASD keys and the top in faces the mouse) but whenever i try to do that the sprite that should be on the top is on the bottom, how do i control sprites from doing this?

Share this post


Link to post
Share on other sites
Advertisement

Generally a z value(or depth in this case) ranges from 0.0 to 1.0 where 0.0 is the foreground and 1.0 is the background.

Share this post


Link to post
Share on other sites

So what command could i use to change the depth while the program is running, such as the character has a depth of 0.5, and you walk up to a rock with 1 depth, then you pick it up, above your head, how would you changes the z axis  to below 0.5?

Edited by Honchkrow

Share this post


Link to post
Share on other sites

Well, in GMStudio, you don't have to do depths between 0 and 1.  Many people use a simple depth=y in the step event to just keep things in depth order top to bottom.  If you have code on the "grabbed" object that is getting lifted over the head, you can simply change it comparing it to the depth of the sprite doing to grabbing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!