Sprite moves off stage very fast without any code to do so

What the bug is:
I encountered a bug where after calculating a combination of vectors from the other sprites in the project, the change x and change y blocks stop working properly, even with their values reset to 0.

How to trigger it:
I have reproduced the bug my inserting the two "item x of calculation step 2" that are in the "move magnetically" custom block into the change x and change y blocks, after which, even if they are removed, they still move the sprite even if they have been manually set to 0.

Your browser/computer (eg. Chrome on Mac OS X):
I am using Firefox on a MacBook Air.

When you saw this bug (the date or Snap! version are equally helpful):
I have seen this bug today, and in the most recent version of snap (9.2.13).

Screenshot of code:

Screenshot of other custom blocks used:

Additional information:
When this bug occurs the "go to random position" block does not move the sprites to values within the stage bounds, and position (as shown in the screenshot) continually increases. I have made sure to apply the changes to the block while testing the bug.

Project link:

This is in the wrong category.
You may ask for help with errors in your simulation code, usually at

There is nothing wrong with the "change...". All sprites are at the center.

Magnetisim 0.0.0 script pic

I made a visualization to check "go to random" boundaries and movements.
:link: Stage (62) :link:

check over your code for a simple error. something like this happened to me but i just forgot to place a bool


This stage image links to the working version of your animation.
The red sprite is the initial random position of every sprite. The line is a trajectory toward the final position. The math inside the "move magnetically" moves every clone to the "average" position of other sprites.
:link: Stage (63) :link:


I believe this is in the right category because the behavior of the script was not due to me writing code that doesn't perform the right task, but instead some problem with how the change x and y blocks worked. My code, even with the bug removed would (probably) still have not created any kind of magnetic effect, which I should have mentioned in my report. I can't seem to reproduce the bug anymore in snap 9.2.14 so I think the bug has been resolved somehow.

I will check out your version of the magnetism project to figure out how to write what I am looking for, and thank you for reviewing the bug.