All Questions

Community

M
Gabriel Matusevich

GameBoard YSort

Why is the GameBoard script extending Node2D instead of YSort?

  • Razoric replied

    It should probably be YSort for consistency, yes. However, it still works even if it isn't.

    Godot will still allow it, because YSort is a descendent of Node2D (Object -> Node -> CanvasItem -> Node2D -> YSort.) The descendance is still valid.

    If you're not going to use any of YSort's methods or properties, making it extend Node2D instead makes it more easily re-used into other projects or nodes that may not call for a YSort. It just so happens that in this case, it's on a YSort Node2D node.