goplus / spx

spx - A Scratch Compatible Go/Go+ 2D Game Engine for STEM education
https://builder.goplus.org
Apache License 2.0
100 stars 28 forks source link

Unexpected behavior of `RotationStyle` #301

Closed nighca closed 3 weeks ago

nighca commented 2 months ago

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

While in spx, the logic is strange:

https://github.com/goplus/spx/blob/72b5b4f2242e9cbfd9017ceba3119d581b7a72e3/spgdi.go#L72-L79

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 commented 3 weeks ago

fixed by #303