Hi there
I am an OOP developer and used to code with Scratch because of science lessons. Well, Scratch has some nice features and using BYOB there is even fun.
Am I able to use any OOP basic features, for example to create instances of objects? I would like to add objects in runtime. Of course I could hide every possibly object, but that would be really, really dirty and lots of c/p work.
I have heard about Elements and that looks nice, but I am not sure whether I am able to use this with Scratch well...
I also like the FP paradigm, but it seems that Scratch forces me to use objects? And every object needs to by one sprite? Right? Can I change that behavior?
Kind regards, Keba.
Offline
Sadly, you can't create instances in normal scratch.
Some people have hacked a "clone" block, but that's as close as you will get. And your last question, I don't think you can change this...
Offline
http://scratch.mit.edu/forums/viewtopic.php?id=33653
Offline
Hi Keba,
as has been pointed out above, Scratch does not (yet) support the concept of abstracting objects into classes and of creating instances. There have been some promising "cloning" hacks (the best one by far, btw, is right in the published source code itself - it's not the "clone hack" you'll find everywhere in these forums, but a simple, well integrated method in the source code named #cloneAndSend: which supports prototype-like instancing). If you dare a little Squeak Smalltalk, you can have a lot of fun with just a tiny modification to the source code (simply add another block to the block specs and evaluate the #buildBlockSpecDict method before saving the image).
I'm excited that you like BYOB! We're currently working on a substantially enhanced version that incorporates some fundamental ideas from Scheme/LISP and that will allow you to call another sprite's custom block by way of the
[ attribute ] of [ spritename ]
reporter block. Then you'll at least have real message passing, which is also a basic OOP feature
Offline
Thanks for your answers
> If you dare a little Squeak Smalltalk, you can have a lot of fun with just a tiny modification to the source code (simply add another block to the block specs and evaluate the #buildBlockSpecDict method before saving the image).
Sounds nice, how to do that? Downloading the source files, editing them and then compiling, I assume? Well, I dont know how to compile on Windows (I am a Linux user). How do you do that?
Or need I an IDE to hack into the source?
//Edit: Hm, I see how to do that using the common Scratch. How do you do that using BYOB? How to turn fullscreen mode off in this mode (I cant shift-click on the R of SCRATCH, because there is no SCRATCH...)?
Last edited by Keba (2010-04-18 09:18:35)
Offline
Well, Jens, would you like to hack the clone block into BYOB? It seems you have removed the image editor for some reason... As you said, hacking the clone block into an image file is no big deal...
So it would be really, reeally nice, if you did that for me...
Kind regards, Keba.
Offline
To truly make it use instances, the best thing to do is use the name block, because names are the only things that are not copied. One will be released in Slash when it comes out.
Offline