Hi, Deiza.
Good suggestion. For a future version, we are considering adding the ability to define your own new blocks. There are many details to work out, such as how to specify parameters and how to make clear the different between writing a normal script vs. defining a new block, and so on. But procedural abstraction is a fundamental computer science idea and it would be nice to be able to demonstrate it within Scratch.
-- John
Offline
I agree that subroutines would be nice, but you can sort of do it with broadcasting and variables.
Offline
patarakin wrote:
May be it will be possible to use same the blocks in different plojects?
I agree, there should be a way to copy a block definintion from one project to another. We'll have to figure a good way to do that. (E.g. block definitions might be attached to exported sprites.)
Thanks for pointing out the need for this...
-- John
Last edited by johnm (2007-03-09 22:56:51)
Offline
Thanks for the replies. I was thinking that to make a re-usable block, there could be a couple of different control blocks, one plain, one which has a variable slot, one which has a condition slot. Very similar to how the loops are, except that, like "Make a variable" you get to pick a name and it creates a new block. The new block is then a placeholder for whatever is in the original block, but keeps your program smaller and easier to read. This wouldn't cover everything possible in subroutines, but would be a nice balance between power and usability (I think).
Great job, my kids are loving Scratch.
Offline
On the note of using "broadcast" for making your own subroutines, it is possible to name a subroutine "broadcast" and then export the sprite which contains the "subroutine" (broadcast stack). Then in a new project you can import the sprite, and the "subroutine" will come with it. Note: Export sprite is above the Scripts panel, and import sprite is under the "extras" menu.
Offline
johnm wrote:
patarakin wrote:
May be it will be possible to use same the blocks in different plojects?
I agree, there should be a way to copy a block definintion from one project to another. We'll have to figure a good way to do that. (E.g. block definitions might be attached to exported sprites.)
Thanks for pointing out the need for this...
-- John
Yes this would introduce non programmers to Scratch as we (building up user community) could provide a library or repository of classical algorithms such as different sorting algorithms or motion algorithms.
This may also create a distance of kids from basic programming that was what made me interested in Scratch in the first place, reminding-me of the good old days of problem solving programming with the Timex ZXSpectrum in the 80'es.
So improve Scratch without loosing the focus on: "simple basic programming tool"
;-)
Altamiro
Offline
i think a "when..." block would be nice.
Offline
Vanslar wrote:
i think a "when..." block would be nice.
Easy. Close Scratch (ScratchFrameMorph). In the browser (World, open..., browser), where in class the 'blockSpecs' (Scratch-Objects, ScriptableScratchMorph, scratch) go to that.
Now, after ('when %m clicked' #M #-) , put ('when %b is true' #W #-) and restart scratch, tada!
If you need help, please reply.
Offline
rdococ wrote:
Vanslar wrote:
i think a "when..." block would be nice.
Easy. Close Scratch (ScratchFrameMorph). In the browser (World, open..., browser), where in class the 'blockSpecs' (Scratch-Objects, ScriptableScratchMorph, scratch) go to that.
Now, after ('when %m clicked' #M #-) , put ('when %b is true' #W #-) and restart scratch, tada!
If you need help, please reply.
You realize there haven't been any replies in this topic since april 2007, right?
Offline
rdococ wrote:
Vanslar wrote:
i think a "when..." block would be nice.
Easy. Close Scratch (ScratchFrameMorph). In the browser (World, open..., browser), where in class the 'blockSpecs' (Scratch-Objects, ScriptableScratchMorph, scratch) go to that.
Now, after ('when %m clicked' #M #-) , put ('when %b is true' #W #-) and restart scratch, tada!
If you need help, please reply.
I did, and it didn't work.
Offline