GML Object fixed on screen position

Discussion in 'Programming' started by streepje8, Mar 17, 2018.

  1. streepje8

    streepje8 Member

    Joined:
    Jan 26, 2017
    Posts:
    27
    Hey there i want to make my object fixed on screen position i am using views so i need some codeing help
    (i have no code yet :(
    But i don't know some option too...)
    i would like a script for my coin display...
    PS: I really did my best to get something but i didn't find something :(
     
  2. Ziphold

    Ziphold Member

    Joined:
    Jun 22, 2016
    Posts:
    103
    Dont use objects. Use sprites.
    Code:
    position_x = 32;
    position_y = 32;
    
    draw_sprite(spr_coin,0,view_xview+position_x,view_yview+position_y);
     
  3. streepje8

    streepje8 Member

    Joined:
    Jan 26, 2017
    Posts:
    27
    oooow thanks GOT IT :D
     
  4. hogwater

    hogwater Member

    Joined:
    Jun 22, 2017
    Posts:
    635
    Use the Draw GUI event.
     
  5. streepje8

    streepje8 Member

    Joined:
    Jan 26, 2017
    Posts:
    27
    is a object/sprite auto fixed on screen if you use the draw gui event?
     
  6. hogwater

    hogwater Member

    Joined:
    Jun 22, 2017
    Posts:
    635
    It allows you to draw things relative to the screen, without aligning them to a view or figuring out how to move them with it.
     
  7. CMAllen

    CMAllen Member

    Joined:
    Mar 2, 2017
    Posts:
    861
    Note that while it will *DRAW* to that position on screen, it will still be located wherever it's placed in the room. In the case of GUI things (like buttons) you won't be able to use normal click or mouse_over events. All of that functionality will have to be written by you and handled in the object's step event. So there is some value in being able to orient objects to screen coordinates instead of room coordinates.
     

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