scratchfoundation / scratchfoundation/scratch-editor

Sprite directions should wrap in the range (-180, 180]

Open
#270 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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:

  1. Create a new sprite and open its code pane
  2. Place a point in direction () block and (direction) block into the scripting area
  3. Enter 180.5 into the point in direction () block as the direction to point in
  4. Run the point in direction () block and then run the (direction) block to see the resulting direction
  5. Observe how the direction has been set to 180.5, unlike in previous versions of Scratch where it was set to -179.5
  6. Enter -179.5 into the point in direction () block as the direction to point in
  7. Run the point in direction () block and then run the (direction) block to see the resulting direction
  8. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.