Scratch-vm: Size property behavior in Scratch 3.0 not compatible with 2.0

Created on 5 Apr 2017  路  4Comments  路  Source: LLK/scratch-vm

Expected Behavior

Size measurement should be the same in Scratch 3.0 and 2.0 to ensure backward compatibility. In 2.0 size is defined as float while in 3.0 the property is rounded to integer.

Actual Behavior

Size differs between versions making some edge cases result in Scratch 2.0 projects not being compatible with 3.0.

Steps to Reproduce

Run and compare this identical project in Scratch 2.0 vs Scratch 3.0:

Observe that the second example will stuck because Intro sprite never reaches 100%

Original issue: https://github.com/LLK/scratch-gui/issues/211

Operating System and Browser

Linux and Google Chrome 56.0.2924.87 (64-bit)

bug help wanted

All 4 comments

Reopening since #522 made set size act like Scratch 2.0, but the size reporter still needs work.

Specifically, the Scratch 2.0 size reporter returns an integer even when the internal size value might have a fractional component. See also: https://github.com/LLK/scratch-flash/blob/develop/src/primitives/LooksPrims.as#L244

@tmickel shared this example on #522:

But the reporter block in scripts does seem to round, e.g., in Scratch 2.0:
screen shot 2017-04-05 at 12 56 49 pm
causes the sprite to say hello.

Ah I see, I'll see if I can fix that right away.

Now the above example is working at least, let me know if you find any more places that needs to change.

Between #522 and #528 I believe this is now fixed.

@rschamp @paulkaplan: In the long term I'd like to consider other possible solutions to this, such as removing the rounding from the reporter in favor of rounding in the GUI combined with adding a tolerance to the = operator. We'd have to control that sort of change with a compatibility flag, though, since it would change project behavior in some cases.

Was this page helpful?
0 / 5 - 0 ratings