Destroy block that only destroy clones

A feature I’d like to see in Hopscotch is:

A destroy block that never destroy the original object

I’d use it for this type of project:

Any project where I want to destroy everything except the original object

Here are some examples of Hopscotch code that could be improved if we had this:

Making sure the original object is never destroyed

15 Likes

First comment. Also great idea.

1 Like

Can’t you just add the destroy block to the clone?

2 Likes

That works but if you want it to be activated like when something is tapped then you can’t.

2 Likes

why not do check if clone index ≠ 0 then destroy?

7 Likes

Good idea! I would definitely use this. If you did something like when object is cloned: destroy, would that destroy all clones and the original object?

3 Likes

when tapped
Check once if clone index = 1
Destroy

This should work.

3 Likes

Yeah. That should work.

1 Like

Oh ya. I forget about the clone index block all the time.

1 Like
check once if 1 not equal to (self)clone index
     destroy
1 Like

You can, right now putting that in a custom block is the best way to do this, but it would be much easier if it was its own block that would always be in the same place.

7 Likes

yeah, I don’t think this will be a thing because we can just use the code I just said and the one someone else said also

1 Like

Interesting.

It’s only like 2 lines of code + there’s always editor clutter to worry abt.

I think its fine the way it is.

Now a

destroy clone index ( )

block might be useful

3 Likes

That it would be better to broadcast a message to get the object to destroy itself. But a version of the destroy block that can’t destroy the original object would be useful if you need the original object to recreate the clones at a later time.

5 Likes

Easy!

“Check once if clone index ≠ 0”, “Destroy”

4 Likes

Mind = blown
:exploding_head:

4 Likes

Or you can do if clone index > 0, destroy

3 Likes

Nice idea! However, there is a way to do this already:
When (self) clone index > 0: Destroy
You could also do , same thing.

3 Likes

Yes

2 Likes

That’s what I was going to say.

1 Like