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

help_me_please
#1

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.

15 Likes
#2

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
#3

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
#4

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
#5

Lemme take a look at it…

1 Like
#6

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

2 Likes
#7

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

3 Likes
#8

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
#9

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
#10

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

1 Like
#11

That is correct, The Incredible Mr. E.

2 Likes
#12

There is a secret block called delete clones mate

1 Like
#13

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

2 Likes
#14

Yup thats right

1 Like
#15

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