This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-07-23 14:16:47

mdusoe
Scratcher
Registered: 2007-06-14
Posts: 32

code re-use

I think it would be great to provide for a mechanism where projects can be reused in other projects.  As an example, I am creating a deck of cards with functionality for shuffling, dealing, manipulating and displaying 52 sprites.  Of course, a module like this could be reused (think Go Fish, cribbage, video poker, etc).  So what about a mechanism like this:

(Assume project GoFish wants to use project DeckOfCards)

Open project GoFish.
Use a menu to select DeckOfCards to Import (or include, or use)
When writing GoFish scripts, have a series of blocks that say things like:
- Broadcast DeckOfCards's Shuffle and wait
- Set DeckOfCards's NumberOfJokers to 0
- When I recieve DeckOfCards's DoneShuffling

Then, to deal cards from within GoFish, I could write:

When GF clicked
set DeckOfCards's destX to -50
set DeckOfCards's destY to 0
Repeat 5 times
Broadcast DeckOfCards's DealOne and wait
change DeckOfCards's by 30
<end repeat>

Not only would this make life easier for those of us stretching the limits of Scratch (which, is not your main focus, I know), but it would also help kids re-inforce the iea of object-thinking and writing dynamic code whenever possible (which is).

I would be more than happy to discuss details further, but I think I have rambled enough for now.

Any other thoughts?

Mike.

Offline

 

Board footer