1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 Help using draw_sprite with relative coordinates.

Discussion in 'Programming' started by AiNaKa, Mar 1, 2019.

  1. AiNaKa

    AiNaKa Member

    Joined:
    Mar 1, 2019
    Posts:
    10
    Anytime i use draw_sprite using relative coordinates such as:
    "draw_sprite(sprite,0,x,y);"
    The sprite will become displaced as the object moves, but i want the sprite to stay fixed relative to the object, and the problem is even further amplified when dealing with views in a room. Is there any way i can draw a sprite relatively to an object so that it doesn't move away from the object when it moves?
     
  2. Andy

    Andy Member

    Joined:
    Jun 20, 2016
    Posts:
    184
    Are you drawing in the Draw event, or Draw GUI event? Also, is this event being ran from within the moving object or, ran from within another (for example a global controller) object?
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,320
    The unwanted displacement only happens when you use that line in the Draw GUI event instead of the Draw event.

    Do you know what each of the 6 basic events do and what the differences between them are?
     
  4. AiNaKa

    AiNaKa Member

    Joined:
    Mar 1, 2019
    Posts:
    10
    I was indeed using the Draw GUI event. I was creating a GUI out of objects that also uses a few drawn sprites, so i assumed using Draw GUI was the one to use. The Draw event worked though, thanks for the help!
     

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