Discuss Scratch

LaptopOkNo246
Scratcher
2 posts

Same code in every sprite


Hi, I was wondering about an idea for a snippet of code which you choose to be in every sprite. There can also be attributes that modify the code for each sprite. For example:
In every sprite

[scratchblocks]
when green flag clicked
move (10) steps
[/scratchblocks]

This will be available to every sprite. For attributes:
[scratchblocks]
define (attribute) parameters and code for every sprite
[/scratchblocks]
[scratchblocks]
if <[(attribute)]=[value]> then
say [Hi]
end
[/scratchblocks]

Last edited by LaptopOkNo246 (Feb. 21, 2022 20:20:09)

Marc92020
Scratcher
1000+ posts

Same code in every sprite

simple workaround: just drag the block into every other sprite
also fixed example:

LaptopOkNo246 wrote:

when green flag clicked
For every sprite {
move (10) steps } :: control

This will be available to every sprite. For attributes:
define (attribute) parameters and code for every sprite
if <(attribute)=[value]> then
say [Hi]
scratchusername40
Scratcher
1000+ posts

Same code in every sprite

So this is basically a way easier way to make custom modules like the built in micro:bit module:



This would actually be really cool, so I support it.
Except instead of having one block you should be able to have multiple, each with their own definition

Last edited by scratchusername40 (Feb. 21, 2022 23:44:20)

Powered by DjangoBB