draw_sprite depth?

Discussion in 'Programming' started by dugtrioramen, Jul 26, 2016.

  1. dugtrioramen

    dugtrioramen Member

    Joined:
    Jul 26, 2016
    Posts:
    77
    I've seen many questions about this online but there wasn't any answer to how to do it, just alternatives.

    So i used draw_sprite_part to draw half of a sprite, and i want to draw the rest of the sprite at a greater depth.
    I tried with draw_sprite_part(2nd half properties) {depth = 11}
    but when i run the game, the whole sprite gets that depth.
    I'm assuming changing depth like that will change the depth of the whole object despite using "with", but is there any other way to do it like that or something similar?
     
  2. jo-thijs

    jo-thijs Member

    Joined:
    Jun 20, 2016
    Posts:
    2,844
    Depth only decides in which order draw events are executed.
    Changing the depth inside a draw event doesn't do anything until the next frame.

    There are only work arounds for this, but there are plenty of them.
    I'm guessing you've read those already.

    You can use multiple objects.
    You can have surfaces.
    You could use 3D.

    For simplicity though, I highly recommend using the first suggestion.
    Have some other instance created in the create event and set a variable to the id of the instance that created it.
    Then make those 2 instances work together.
     
    dugtrioramen likes this.
  3. dugtrioramen

    dugtrioramen Member

    Joined:
    Jul 26, 2016
    Posts:
    77
    Actually I did try multiple objects but its working now with instance_create of the same object
    thanks again
     
  4. bojack29

    bojack29 Member

    Joined:
    Jun 21, 2016
    Posts:
    407
    You cant draw items at different depths. Only the depth by which the depth the object itself is drawing. You can drae things in different orders within the object but it is still at its desired depth.
     
  5. 12ashbaker

    12ashbaker Member

    Joined:
    Aug 14, 2017
    Posts:
    76

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice