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

#1 2008-08-11 07:21:11

Snifi
Scratcher
Registered: 2008-08-10
Posts: 7

Paint method for Building Blocks?

Those beauty Building Blocks of Scratch programm, what kind of method you developers used to paint them onscreen, on the source code level? Are the symbols available for download and use in other projects?

I'm sorry, I can't access the Squeak-source, so I can't find it myself.

Thanks!

Offline

 

#2 2008-08-11 13:08:16

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Paint method for Building Blocks?

I don't know much about Squeak, but you can download the Scratch 1.2.1 source here.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#3 2008-08-13 10:23:23

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: Paint method for Building Blocks?

Hi, Snifi.

The blocks are built programmatically out of lines and rectangles and text. They are not pre-built images. They can also be drawn using vector graphics.

   -- John

Offline

 

#4 2008-08-15 07:25:23

Snifi
Scratcher
Registered: 2008-08-10
Posts: 7

Re: Paint method for Building Blocks?

Ok, I got the source code visible now. I start Squeak this way:

~/Scratch/squeak/3.9-8$ ./squeak ScratchSourceCode1.2.1.image

I don't know if this is the right way to start it? I get some error messages, but the source, i think, is now searchable.

But now I need a bit more help, because I am quite new to Scratch, Squeak and Smalltalk. How can I find the block painting routines in the object browser? I mean, lets take example: I want to convert the blocks to other programming language, so the need is to get simple routines like: set pen color: BLACK, paint rectangle at (x1,y1,x2,y2) = (10,10,100,20), floodfill it red, put some text, etc...

Offline

 

#5 2008-08-15 07:46:55

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Paint method for Building Blocks?

Hi Snifi.

There is a class called BlockMorph. You might want to inspect its class hierarchy, and have a look at the category named "drawing" on the instance side. There you'll find (some of) what you're looking for, although, as John already pointed out, it's really just lines, rectangles and text.

If you're only interested in the graphics and the attaching/detaching behavior, you might also have a look at my "PuzzlePieces" code on SqueakMap: http://map.squeak.org/package/173b6802-59fa-4580-bdde-482511240a41

Overall it might be easier to reimplement Scratch "from Scratch" in Python than to try directly transforming it from Smalltalk. However, if I remember correctly there might already be some tile-based Python extension inspired by Etoys around somewhere, I just can't find the link to it right now (but I'll keep looking...)


Jens Mönig

Offline

 

#6 2008-08-15 08:00:01

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Paint method for Building Blocks?

Okay, here are some other links you might want to check out:

- TurtleArt on the XO: http://wiki.laptop.org/go/Turtle_Art
- PataPata (this one's in Python for sure): http://sourceforge.net/projects/patapata
- PyMorphic: http://pymorphic.sourceforge.net


Jens Mönig

Offline

 

Board footer