Delete Clone Block not working? (Or is it just my code...?)

This project here, called Spinny G​un isn’t working.


You just tap to shoot the g​un, and if you miss the orange targets, you lose. I don’t understand why the bullets aren’t being deleted when they hit the squares/targets. The ‘Targets’ object is setting a variable to one when it is within 25p of the bullet. The bullet then recognises that, and decides that it doesn’t feel like deleting itself for some reason. @CodeHelp.
Thanks in advance.

16 Likes

That’s odd…I tried experimenting a bit but I think you’ll have to use the box method to destroy the object.

Like this

When (Self X Position) > 1014) or (Self X position) < 10) or (Self Y position) > 768) or (Self Y position) < 0)

Destroy Object

End

Doing the same for the square x and y position, this should work.

Odd. It doesn’t.

4 Likes

I think you ran into this issue: if you delete an object, you cannot reference its collision or orange values anymore. Otherwise the game freezes

3 Likes

Ok I got it. Gimme a moment


Under Score, when bullets bumps track should not set play to 0 (that stops everything), I think it should be bump, but change that

Wait no

something is wrong with the collision system. Bullets getting destroyed freeze the project, and the tracks don’t clone successfully – use the destroy block sparingly

4 Likes

Lemme take a look at it…

1 Like

What does that mean I should do in my code though?

2 Likes

I think that it’s because the destroy object block destroys the first clone… otherwise idk

3 Likes

I don’t really know. But the destroy should be executed at a different time, and the targets don’t seem to reappear, what is the point of destroying them instead of just re-positioning them

1 Like

Oh, I think that maybe it’s because Hopscotch only has the “create a clone” block. If you want to delete clones, you can do that on Scratch.

Conditions:

  • The “delete clone” block is an end block, so you cannot put any scripts after it in a line of code.
  • If you want to use it, you will have to make sure the starter rule says “when I start as a clone”.
1 Like

:man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming: :man_facepalming:
come on now, you have not heard of JSON editing?

1 Like

That is correct, The Incredible Mr. E.

2 Likes

There is a secret block called delete clones mate

1 Like

…and a secret block called Destroy Clone that can be accessed via json editing (I think it’s json editing at least)

2 Likes

Yup thats right

1 Like

Yeah. I don’t use json editing, so that was all I had to say.

Bump @Leaders clive?

1 Like

Are we sure that this was solved?

1 Like

It’s not the block, since it works fine for me. So either it’s fixed, or it is their code?

2 Likes

I see. It looks like @MISSION_IMPOSSIBLE has not been active for a while.

I will close this for now - but just let me (or any other leader) know if it needs to be reopened in the future!

2 Likes

record scratching sound effect