Skip to content

Compatibility

Eric Rosenbaum edited this page Feb 28, 2019 · 31 revisions

There is a special build specifically for testing projects in 2.0 vs. 3.0: add /compatibility-testing.html. You can add #<project-id> to the end to load up a specific project (it must be shared, however). You may also have to specifically whitelist the domain in your flash settings to get the Scratch 2.0 player to load.

Consistent type coercion when modifying variables

In Scratch 2.0 if you set [var] to [var + 1] and the variable contains a string, you get 1. If you change [var] by [1] when the variable contains a string, you get NaN. In 3.0 both now have the same behavior and return 1.

Consistent rounding method for list indexes

In Scratch 2.0 if you delete [1.5] of [list] it will delete the item at index 2 as the index is rounded. However if you replace item [1.5] of [list] with ["thing"] it will replace the item at index 1 as floor is applied to the index. In 3.0 floor is now applied consistently for all index arguments on list blocks.

Reference: https://github.com/LLK/scratch-vm/issues/202

List Item Limit

Lists now have a limit of 200,000 items.

Reference: https://github.com/LLK/scratch-vm#1031 and corresponding comment about the new list limit

Keyboard input capturing

All keys are captured by Scratch 2.0 when it has focus, so if you use browser keyboard shortcuts e.g. Cmd-Opt-J, the browser does not respond to them. In 3.0, special keys are allowed to propagate so the browser keyboard shortcuts work while Scratch has focus. Scratch 3.0 will continue to register these keys, so when any key pressed blocks will trigger at the same time as the browser shortcut activates.

Touching sprite works with self

Unlike Scratch 2.0, the "touching []" boolean reporter will no longer return true at all times if the reporter argument is set to itself. Instead it will return false unless the rendered target is touching another instance of itself.

Reference: https://github.com/LLK/scratch-vm/issues/377

Consistent direction for "whirl" graphic effect

Scratch 2.0 has two stage modes: 2D and 3D. The "whirl" graphic effect is applied inconsistently between these two modes (clockwise in 2D and counter-clockwise in 3D). Because most users see the 3D stage when using Scratch 2.0 and Scratch 3.0 always uses WebGL for rendering, we have decided to normalize to counter-clockwise application of the "whirl" effect.

Reference: https://github.com/LLK/scratch-render/issues/22

Variable monitors always rendered on top of stage

Scratch 2.0 allows for sprites to occlude monitors as they are treated as part of stage rendering. In Scratch 3.0 monitors are rendered as part of the overall user interface and are independent of the stage. Because of this, sprites can no longer be rendered on top of monitors.

Broadcast Messages

Unused broadcast messages are removed whenever the current workspace or the toolbar gets updated (e.g. switching between the Blocks/Sound/Costume editors, switching sprites, adding a new variable or list). This is slightly different from Scratch 2.0 behavior, in which switching to a different block category can also trigger the auto-deletion behavior.

Broadcast messages will not default to an empty message name when a plugged-in input gets unplugged. In Scratch 2.0, if you plug in a (join (hello ) (world)) block into the input of a (broadcast (my message)) block, the my message gets deleted as a message name. Unplugging the (join (hello ) (world)) block reveals an empty message name which can be used as a real message. The user cannot explicitly create an empty message like this in any other way. In Scratch 3.0, plugging in a block into the input of a broadcast block does not delete the message underneath it and this message does not get auto-deleted.

When importing a Scratch 2.0 project that uses an empty message name into Scratch 3.0, the empty message name gets translated into a fresh message name of the format message# where # is an integer greater than 0 such that message# does not already exist.

Issue: https://github.com/LLK/scratch-blocks/issues/1290

PR: https://github.com/LLK/scratch-blocks/pull/1302

Variables and lists can share names

In Scratch 2.0, attempting to create a list with the same name as a variable (or vice-versa) triggers a pop up that says "That name is already in use." In Scratch 3.0, variables and lists are allowed to share names.

Lists can be renamed

In Scratch 2.0, only variables could be renamed. In Scratch 3.0, both lists and variables can be renamed.

Backdrops named 'previous backdrop' and 'next backdrop' can be switched to via blocks (HT @joker314)

In Scratch 2.0, switch backdrop to [next backdrop] would switch to the backdrop sequentially following the current backdrop, even if there was a backdrop named "next backdrop". The same behavior is seen in "previous backdrop".

This differed from the behavior of the switch costume block, which would not perform the block input's special function if there was a costume with the corresponding name.

To make the blocks more intuitive, the switch backdrop block now uses the switch costume behavior.

Set and change volume blocks now yield

In Scratch 2.0, the set volume and change volume blocks did not yield.

In 3.0, these blocks now yield for a tick. One reason for this change is to make it consistent with the new set pitch effect and change pitch effect blocks, which are themselves consistent with the graphic effects blocks, all of which yield for a tick. You can make a loop in Scratch containing a "change by" block of any of these types, and see the effect happening over time- if they did not yield, it would be instantaneous, rather than an animation. So, for example, to make the sound fade out over a few seconds, you can now use repeat 100 / change volume by -1.