GMS 2 Object parent

Discussion in 'Programming' started by mikix, Oct 9, 2019.

  1. mikix

    mikix Member

    Joined:
    May 2, 2017
    Posts:
    359
    Why can I only have one parent for an object? Is there a way to have more?
     
  2. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,742
    Yes, it's called a grandparent. Objects are treated as special cases of everything they are descendants of, even if it's not directly... e.g. not just their parent, but also the parent of their parent's parent (and so on). Their empty events will run code of their nearest ancestor (and with liberal use of event_inherited you can run the code of ALL their ancestors, if required).
     
    ParodyKnaveBob and mikix like this.
  3. mikix

    mikix Member

    Joined:
    May 2, 2017
    Posts:
    359
    Thank you for this information!
     
    ParodyKnaveBob likes this.

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