scratchfoundation / scratchfoundation/scratch-editor
Sprite directions should wrap in the range (-180, 180]
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 281
- Forks
- 276
- Avg merge
- 7d 8h
- Merged PRs (30d)
- 6
Description
Expected Behavior
Scratch 3.0 wraps the direction of a sprite to fit in the range -180 (exclusive) and 180 (inclusive), just as Scratch 1.4 and 2.0 did.
| Direction | Scratch 3.0 ✅ | Scratch 2.0 ✅ | Scratch 1.4 ✅ |
|---|---|---|---|
| -179.5 | -179.5 | -179.5 | -179.5 |
| -179.0 | -179.0 | -179.0 | -179.0 |
| 180.0 | 180.0 | 180.0 | 180.0 |
| 180.5 | -179.5 | -179.5 | -179.5 |
Actual Behavior
Scratch 3.0 wraps the direction of a sprite to fit in the range -179 (inclusive) and 181 (exclusive).
| Direction | Scratch 3.0 ❌ | Scratch 2.0 ✅ | Scratch 1.4 ✅ |
|---|---|---|---|
| -179.5 | 180.5 | -179.5 | -179.5 |
| -179.0 | -179.0 | -179.0 | -179.0 |
| 180.0 | 180.0 | 180.0 | 180.0 |
| 180.5 | 180.5 | -179.5 | -179.5 |
Steps to Reproduce
Steps to reproduce the behavior:
- Create a new sprite and open its code pane
- Place a
point in direction ()block and(direction)block into the scripting area - Enter
180.5into thepoint in direction ()block as the direction to point in - Run the
point in direction ()block and then run the(direction)block to see the resulting direction - Observe how the direction has been set to
180.5, unlike in previous versions of Scratch where it was set to-179.5 - Enter
-179.5into thepoint in direction ()block as the direction to point in - Run the
point in direction ()block and then run the(direction)block to see the resulting direction - Observe how the direction has been set to
180.5, unlike in previous versions of Scratch where it was set to-179.5
System Details
N/A (This issue is not platform-dependent as far as I am aware.)
Screenshots
Scratch 1.4
https://github.com/user-attachments/assets/5d700c73-997d-478c-a792-0d8cc8f0cd66
Scratch 2.0
https://github.com/user-attachments/assets/055e9f11-91a2-495d-9726-8dc095955bd1
Scratch 3.0
https://github.com/user-attachments/assets/27ad5a87-646d-4538-83e1-068a4b987e24
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Reproduce the direction-block behavior described above, then locate the sprite-direction handling and add coverage for the requested boundary behavior; done means values wrap to (-180, 180] like Scratch 1.4 and 2.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100