Discuss Scratch

fezzinate
Scratcher
100+ posts

Global Access to Custom Blocks

Proposal:
I'm proposing the addition of a default block within the “More Blocks” tab, much like the sprite property sensor, which gives you global access to custom blocks within specific sprites from anywhere in your project.

To illustrate the idea:
Once placed onto the canvas area, the block will automatically append the required parameters as defined by the user for the specified block


Calling custom blocks for specific clones:
Building on this idea, and combining it with my other suggestion (read here: Handling Sprite and Clone Variables), we can also call custom blocks for specific clones


Side Note:
A somewhat related suggestion - it'd be great if custom blocks gave named field hints that go away once you click inside them. Currently, you either have to hunt down the definition to remember what the fields were, or resort to labeling every field and end up with a super long and clumsy custom block.


Why it's useful:
Unlike broadcasts, this allows you to not only call code from specific sprites (as opposed to the global nature of broadcasts), but also allows you to send parameters along with it. This allows for much cleaner code and lends itself closer to how one would organize a class structure in other languages; essentially treating sprites as classes, and custom blocks as their methods/interface.

The goal here is encapsulation; something that scratch only, well, scratches the surface on, but has tremendous potential for. One of Scratch's main goals is to learn by sharing/tinkering. In practice, although there are many mechanisms in place to encourage it, it can be quite difficult due to how tangled scratch code can become. The way I see it, encapsulation encourages true sharing. It allows users to take pieces and use them in their own projects without getting lost in spaghetti code. Publicly accessible custom blocks allows for programs to interface with encapsulated code in a non-destructive fashion.

Last edited by fezzinate (Aug. 28, 2014 15:14:52)

DemCupcakesYo
Scratcher
100+ posts

Global Access to Custom Blocks

Support.
MushroomMan99
Scratcher
100+ posts

Global Access to Custom Blocks

Support
fezzinate
Scratcher
100+ posts

Global Access to Custom Blocks

BUMP: Added a bit about combining this idea with my other suggestion for handling clones (read about it here: http://scratch.mit.edu/discuss/topic/50360/ )

Last edited by fezzinate (Aug. 27, 2014 03:28:17)

fezzinate
Scratcher
100+ posts

Global Access to Custom Blocks

Bumping for further discussion. Anyone have more thoughts on this?
eitanschischa
New Scratcher
1 post

Global Access to Custom Blocks

well done
TheRealDeanMeTn
Scratcher
12 posts

Global Access to Custom Blocks

when this sprite clicked
5cookie
Scratcher
12 posts

Global Access to Custom Blocks

This confuses me.

Powered by DjangoBB