Skip to content
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

fix: Unify Die behavior of initial / cloned sprite #314 #329

Merged
merged 4 commits into from
Sep 11, 2024

Conversation

qlli
Copy link
Contributor

@qlli qlli commented Sep 10, 2024

Unify Die behavior of initial / cloned sprite #314
This fix is temporary. It's better to switch to the prefab/instance workflow like unity.


func (p *Sprite) Destroy() { // delete this clone
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As proposed here, a public method named DeleteThisClone is expected to be offered:

  • Rename current destroy to deleteThisClone for compatibility with Scratch's Delete This Clone

sprite.go Outdated
}

func (p *Sprite) Destroy() {
func (p *Sprite) doDestroy() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A public method called Destroy as part of the sprite's APIs is also expected.

  • Introduce new destroy, which always destroys the current instance, regardless of whether it's the initial or a cloned instance

@@ -509,6 +509,14 @@ func (p *Sprite) Destroy() {
}
}

func (p *Sprite) DeleteThisClone() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is advisable to comment for the purpose of DeleteThisClone here, as it appears redundant with Destroy and Die provided.

Copy link
Collaborator

@nighca nighca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xushiwei xushiwei merged commit b1f0ef6 into goplus:main Sep 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants