Discuss Scratch

Gustavo6046
Scratcher
100+ posts

Clone Pointers

Currently the clone referencing system is a complete dumbness. You can only refer to all clones of a specified sprite.
But if we get some clone pointers…

A clone pointer is a variable that looks like this:

([nearest v] clone)
([furthest v] clone)
([biggest v] clone)
(clone with [size v] [bigger than v] [20])
etc

but with { } tips instead of ( ) ones.

It can be used in special functions to reference to some clones of a sprite, e.g.

define delete closest [Sprite1 v] clone
if <touching (any clone of [Sprite1 v]) ?> then
delete clone ([nearest v] clone of [Sprite1 v])
end

but it may have many more uses. And much more!

It can also be used for cooperative AI in clones. Polisoccer hardly defines cooperative AI because it has quite dumb AI even for its very smartness relative to other Scratch projects that have AI…

Last edited by Gustavo6046 (Dec. 24, 2015 15:41:06)

alexphan
Scratcher
1000+ posts

Clone Pointers

Good ideas, but can't classes and structs just be lists?
Semi-support.
Gustavo6046
Scratcher
100+ posts

Clone Pointers

alexphan wrote:

Good ideas, but can't classes and structs just be lists?
Semi-support.
Structs can be downed into lists, but classes….
As classes hold information of constructors/initializers and functions, this won't work, unless the class in question only holds variables – not noting that classes are initialized, not just stored!

Last edited by Gustavo6046 (Dec. 24, 2015 00:19:59)

DaSpudLord
Scratcher
1000+ posts

Clone Pointers

The first two sound like lists, or that they can be workarounded with lists. The last one, I don't understand- can you please elaborate?

All of these sound really complicated, something that may confuse even non-new Scratchers. No support.
BookOwl
Scratcher
1000+ posts

Clone Pointers

suggestion has changed

Last edited by BookOwl (Dec. 29, 2015 19:17:37)

PrincessPanda_test_
Scratcher
1000+ posts

Clone Pointers

No support, can be very confusing especially to the new ones. Scratch is supposed to be an introduction to coding.
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Clone Pointers

I don't know anything about the other suggestions, but I do understand classes, and I will explain to those who don't.

A class is simply a way to represent data. It is a custom “data type,” upon which variables called “objects” are modeled upon. Classes are made up of variables and functions (custom blocks). Class members are divided into two groups: Instance and static. Instance members may differ among different objects, such as one object of class Vehicle having the value of “wheels” to be 2, and another object of class Vehicle having the value of “wheels” to be 4. Static members are constant for all objects, and can be used without objects. For example, a class could have a static variable to count the amount of objects created.

Classes are useful because they model real-life things. They also allow programmers to use code without having to understand implementation details (how it was programmed).

Last edited by gdpr533f604550b2f20900645890 (Dec. 24, 2015 01:30:10)

Gustavo6046
Scratcher
100+ posts

Clone Pointers

Pointers come from C++ but while they are advanced in their language, can be made extremely simple in Scratch – abolition of symbols * and &. Sorry if I didn't elaborate.

Pointers are variables that point to other variables, actors, or clones. Their real content is the adress of the target.
They can be used to refer only to a specific clone of a actor, so that you can e.g. make team games like Polisoccer even easier (and AIs smarter).
Please, if someone understand Pointers, explain it better because I'm not at the mood right now…
ChocolatePi
Scratcher
1000+ posts

Clone Pointers

Pointers seem like a language feature that would be too overkill for a simple language such as Scratch.

While it would seem cool, Scratch takes care of memory management and pointers are a big part of that. Maybe something like a reference to sprites as a new data type…?

Pointers were a language feature popularized by C that made it able to modify variables through functions and through other things. That is, if you wanted to modify a variable `var`, then you could try passing it through the function, but that wouldn't modify it. Then you could try passing through a reference to `var`, making the value passed in the location of memory that `var` takes up, making you able to modify it.

I think that it would be cool to have a similar feature in Scratch – just leave out pointer arithmetic, the heap, etc.
Gustavo6046
Scratcher
100+ posts

Clone Pointers

Bravo! I think it would be more useful to point to sprites and their clones, as currently clone reference is a very dumb system…
Zekrom01
Scratcher
1000+ posts

Clone Pointers

PrincessPanda_test_ wrote:

No support, can be very confusing especially to the new ones. Scratch is supposed to be an introduction to coding.
Gustavo6046
Scratcher
100+ posts

Clone Pointers

Pointers are designed to be simple. Scratch would have a security system to prevent such memleaks and segfaults. Screw classes and structs though…
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Clone Pointers

Not understanding a suggestion is not a reason to say “no support.” From my experience, whenever someone doesn't understand a suggestion, they say that it's too complicated for beginners. Please make an effort to understand the suggestion before casting your vote, folks.

EDIT: Ninja'd by the OP

Last edited by gdpr533f604550b2f20900645890 (Dec. 24, 2015 14:48:59)

Gustavo6046
Scratcher
100+ posts

Clone Pointers

Updated the OP with a better suggestion to deserve the name “Pointer”.
ChocolatePi
Scratcher
1000+ posts

Clone Pointers

Gustavo6046 wrote:

Bravo! I think it would be more useful to point to sprites and their clones, as currently clone reference is a very dumb system…
Snap! (a complete rewrite of Scratch for CS students) has a very cool feature to do this. Whenever you drag a sprite in the Sprite Panel to the block editor, it turns into a reference to the sprite which you can do stuff with, like control it using lambdas and stuff

EDIT: So I was wrong about the dragging out thing, but they still have a way to use references to sprites in scripts xP

Here's Snap!: http://snap.berkeley.edu/run

Last edited by ChocolatePi (Dec. 24, 2015 15:00:45)

Gustavo6046
Scratcher
100+ posts

Clone Pointers

ChocolatePi wrote:

Gustavo6046 wrote:

Bravo! I think it would be more useful to point to sprites and their clones, as currently clone reference is a very dumb system…
Snap! (a complete rewrite of Scratch for CS students) has a very cool feature to do this. Whenever you drag a sprite in the Sprite Panel to the block editor, it turns into a reference to the sprite which you can do stuff with, like control it using lambdas and stuff

EDIT: So I was wrong about the dragging out thing, but they still have a way to use references to sprites in scripts xP

Here's Snap!: http://snap.berkeley.edu/run
Thanks, but I am talking about CLONES. Read the OP again, please? Also I didn't like Snap!'s non-beginner-friendly colors and interface…

Last edited by Gustavo6046 (Dec. 24, 2015 15:03:12)

MathlyCat
Scratcher
1000+ posts

Clone Pointers

Lists and clone ids, too easy to workaround.

When you say “etc” it sounds incomplete, please expand?
As well as “many more uses” what ARE the other uses???

I don't like dead ending suggestions because they only partially sum up the idea and I can't support them.

No support.
Gustavo6046
Scratcher
100+ posts

Clone Pointers

MathlyCat wrote:

Lists and clone ids, too easy to workaround.

When you say “etc” it sounds incomplete, please expand?
As well as “many more uses” what ARE the other uses???

I don't like dead ending suggestions because they only partially sum up the idea and I can't support them.

No support.
Ok, added another use. It is simple enough to be understood without any example at all though.
Gustavo6046
Scratcher
100+ posts

Clone Pointers

Nobody else? I though there were more critics going to rate this; clone pointers aren't this complicated… Read the OP, please!
liam48D
Scratcher
1000+ posts

Clone Pointers

So basically first class clones. Support, but duplicate. Maybe you should check out http://snap.berkeley.edu?

Powered by DjangoBB