This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Advanced Topics
  •  » Pointers and objects, collections, For Each, messages with parameters

#1 2007-05-17 01:00:13

Xalem
Scratcher
Registered: 2007-05-17
Posts: 3

Pointers and objects, collections, For Each, messages with parameters

Can I have a variable point to a sprite, or a costume, or a sound, or a background?
Can I create a collection, or a list of a certain object type?
Can I do a for...each on every item in my list?
Can I create a new object?
Can I send a message to a particular object only?
Can I send a messsage with a parameter, or even a parameter list?
Can I please, please, please!

Offline

 

#2 2007-05-17 01:10:50

paulmedwal
Scratcher
Registered: 2007-03-09
Posts: 100+

Re: Pointers and objects, collections, For Each, messages with parameters

1. No, variables only hold numbers.
2. No, you cannot create lists or collections of objects.
3. You can use broadcast blocks and when I receive blocks to send "for...each" like messages to all of the sprites.
4. No, you can not dynamically create a new object. You can paint your own sprites or use them from a file though.
5. You can send a message to all objects using the broadcast blocks and the When I receive blocks inside of the control category.
6. No, you cannot send message with parameters. But you can use variables as global variables and probably accomplish the same thing.
7. Yes you can can can ask more questions on the forums, and the community will attempt to answer.

Paulmedwal


clutter.scratch.mit.edu Visit the Clutter site to create multi-scene stories and multi-level games with Scratch.

Offline

 

#3 2007-05-17 08:43:24

rszrama
Scratcher
Registered: 2007-05-15
Posts: 25

Re: Pointers and objects, collections, For Each, messages with parameters

Xalem wrote:

Can I have a variable point to a sprite, or a costume, or a sound, or a background?
Can I create a collection, or a list of a certain object type?
Can I do a for...each on every item in my list?
Can I create a new object?
Can I send a message to a particular object only?
Can I send a messsage with a parameter, or even a parameter list?
Can I please, please, please!

You could write your program in C++.   tongue

Offline

 

#4 2007-05-17 09:11:57

bernatp
Scratcher
Registered: 2007-03-07
Posts: 49

Re: Pointers and objects, collections, For Each, messages with parameters

Xalem wrote:

Can I have a variable point to a sprite, or a costume, or a sound, or a background?

You can insert a variable into switch to costume ..., switch to background ... and play sound ... . The value of the variable will select the costume, background or sound by ordinal number.

Offline

 

#5 2007-05-18 11:47:08

Xalem
Scratcher
Registered: 2007-05-17
Posts: 3

Re: Pointers and objects, collections, For Each, messages with parameters

Thank you to the members who pointed out that Scratch currently cannot do any of the things that I asked.

I actually knew that.

I was asking the authors of scratch if they would implement these rather useful features.  Why can't we create variables that work like pointers?(or more specifically class variables) Why not code some kind of collection variable that contains a list of objects?  Why not something as simple as messages with parameters, or messages targeted to specific images?  Of course I can implement some kind of hack (for example pass my parameters as integers to a global variable) but, why should I?  And why not give the 10 year olds who are using this some useful coding experience.

It is true that my generation learned to code without having access to objects (or even access to simple things like coding functions with parameters.)  But, the goal of Scratch is not to recreate AppleSoft Basic with all its limits.  So, I am suggesting one way in which object oriented programming could be done.  And, since this program is for kids, I asked like a kid.  Can I, Can I , Can I pleeeze have these features implemented in a future version.

Offline

 

#6 2007-05-18 12:21:21

Bridges-PdP
Scratcher
Registered: 2007-05-15
Posts: 9

Re: Pointers and objects, collections, For Each, messages with parameters

If Scratch were to develop over time to include all those programming features (as well as all those mentioned by others(interoperability with Flash, compiled executables, open source and cross platform) at what point would it still be an appropriate platform for introducing children to programming concepts?

Perhaps when a student begins to ask for many of these same capabilities she is ready to move to a new dev platform altogether. I love Scratch so far. It has a lot going for it, but it has some limitations and I have to remind myself what kind of users it's designed for.

"Scratch is designed to help young people (ages 8 and up) develop 21st century learning skills. As they create Scratch projects, young people learn important mathematical and computational ideas, while also gaining a deeper understanding of the process of design."


Scott

Offline

 

#7 2007-05-18 12:40:06

Canthiar
Scratcher
Registered: 2007-05-16
Posts: 100+

Re: Pointers and objects, collections, For Each, messages with parameters

Xalem wrote:

So, I am suggesting one way in which object oriented programming could be done.

From what I've seen Scratch is very much an object oriented programming language.  Each object can have its own set of variables and scripts and each object is instanced.  Arrays and pointers seem to be concepts that I've even seen college level students have a hard time grasping, let alone your average grade school kid.

Offline

 
  • Index
  •  » Advanced Topics
  •  » Pointers and objects, collections, For Each, messages with parameters

Board footer