-
Notifications
You must be signed in to change notification settings - Fork 28
SimpleCharacter: Don't impose a collision shape #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There is no need for this cleanup because from docs: [1] > If the node has children, its _exit_tree callback will be called last, > after all its children have left the tree. Also because: [2] > when a node is freed with Object.free or queue_free, it will also free > all its children. Further, this removes the sprite and collision while in the editor when the user switches to another scene tab #213. [1] https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-private-method-exit-tree [2] https://docs.godotengine.org/en/stable/classes/class_node.html#description Fixes #213
Change the logic so there is no fallback 100x100 collision shape if a texture is not provided. This way the user can customize their character by adding their own sprites and collision shapes as node children. The simple setup of passing a texture is still maintained. Although it has been found to be inflexible (can't resize the texture from the canvas, can't change the shape of the collision). Addresses #215
Note: this is on top of #214 |
for label in _score_labels.values(): | ||
label.queue_free() | ||
_score_labels.clear() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This benefits from add_child().
if sprite: | ||
sprite.queue_free() | ||
sprite = null | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These benefit from add_child().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM!
Change the logic so there is no fallback 100x100 collision shape if a
texture is not provided. This way the user can customize their character
by adding their own sprites and collision shapes as node children. The
simple setup of passing a texture is still maintained. Although it has
been found to be inflexible (can't resize the texture from the canvas,
can't change the shape of the collision).
Addresses #215