[go: up one dir, main page]

  • Black Xanthus@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 month ago

    That’s really helpful, thank you.

    It would be helpful (to a noob like me) if ‘composition’ could be explained a bit better.

    • monica_b1998@lemmy.worldOP
      link
      fedilink
      arrow-up
      2
      ·
      1 month ago

      I appreciate your feedback! Would it be helpful if I add something like this?: “Composition in Godot is the practice of building complex objects by assembling smaller, reusable nodes (e.g., adding a HealthComponent node to an enemy) rather than relying on deep, rigid class inheritance hierarchies. It promotes flexibility, allowing behaviors to be added or removed at runtime, whereas inheritance creates tight coupling between parent and child classes.”

      • Black Xanthus@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 month ago

        Exactly that!

        Thank you. This is one of the most useful articles I’ve read in my (very slow) Godot journey. Coming from OO programming to something like Godot, finding the reusable bits, and how all that is meant to work has been the most frustrating. Mostly, it seems, because people assume we all have the same understanding of terms.

        When you say the node is reusable, is this a ‘cut and paste’ the node in (so all future changes to the base node is lost) or is the another way? The only way that has worked has been a one-scene node so I can update the node and it updates in all scenes using it.

        I’m sure I’m missing something!

        Very well done! Thank you!