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

Unexpected behavior of RotationStyle #301

Closed
nighca opened this issue Jul 5, 2024 · 1 comment
Closed

Unexpected behavior of RotationStyle #301

nighca opened this issue Jul 5, 2024 · 1 comment

Comments

@nighca
Copy link
Collaborator

nighca commented Jul 5, 2024

In Scratch, for a sprite with rotationStyle: left-right:

  • heading: [0, 180] is considered facing right
  • heading: (-180, 0) is considered facing left

While in spx, the logic is strange:

spx/spgdi.go

Lines 72 to 79 in 72b5b4f

} else if p.sprite.rotationStyle == LeftRight {
if math.Abs(p.sprite.direction) > 155 && math.Abs(p.sprite.direction) < 205 {
geo.Scale(-1, 1)
}
if math.Abs(p.sprite.direction) > 0 && math.Abs(p.sprite.direction) < 25 {
geo.Scale(-1, 1)
}
}

I don't understand. But it causes some result that is IMO not expected, for example:

setRotationStyle LeftRight

setHeading float64(Left)  // spx will render the sprite facing right
setHeading float64(Down)  // spx will render the sprite facing left
setHeading float64(Right) // spx will render the sprite facing right
setHeading float64(Up)    // spx will render the sprite facing right

I think it is reasonable to adopt the same logic as Scratch.

As discussed, we should adopt the same logic as Scratch.

@nighca
Copy link
Collaborator Author

nighca commented Aug 16, 2024

fixed by #303

@nighca nighca closed this as completed Aug 16, 2024
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

No branches or pull requests

1 participant