how do I get a sprite drawn over an object to change direction?

Discussion in 'Programming' started by pixeltroid, Jun 29, 2019.

  1. pixeltroid

    pixeltroid Member

    Joined:
    Jul 23, 2016
    Posts:
    665
    so basically the object has a code that causes its sprite to change direction to face the player. This works fine.

    However, the object has another sprite attached to it in the draw event. This is the code for it:

    Code:
    draw_self();
    draw_sprite(spr_hand1, -1, x+16, y+6);
    
    The problem I am facing is that when the object changes direction, the attached sprite spr_hand1 remains facing the same direction. How do I make it so the attached sprite also changes direction along with the parent object?

    Any help will be appreciated!
     
  2. Bayesian

    Bayesian Member

    Joined:
    Sep 13, 2016
    Posts:
    423
  3. pixeltroid

    pixeltroid Member

    Joined:
    Jul 23, 2016
    Posts:
    665
    Nevermind. I figured out a way. I just placed the sprite to an object, and attached that object to the main object.
     

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