Movement buttons disappearing when restarting project

I was working on my #SpaceAdventure project, and I wanted to test the movement arrows to see if they were positioned right. I restarted the project and then they disappeared! Here is the code for one of the buttons:


hm, did you notice the block is ‘Set Origin’ and not ‘Set Position’


I like to use set origin because it can look cleaner in the bottom left corner

Can you link the project itself? I don’t see any issue with the code you showed, though.

1 Like

Well, I don’t want to link it but I’ll try to make a new project to narrow it down
(I don’t want to link so it won’t get spoiled lol)



1 Like

It’s because of the set origin that this bug is happening
So you can use set position instead to fix it


Yeah, but set origin isn’t supposed to set an emoji to different positions every time you restart the project. It’s supposed to always be at origin x 50, y 50 (referencing the bottom left hand corner)


that’s the bug

1 Like

No, the buttons just disappear.


How do you know it did just position it offscreen?

If you keep restarting, the buttons comes back and disappear, then back again…


I don’t think it’s positioning off-screen, because I set it to 50, 50

For me, it changed positions on first restart, then disappeared on second restart.

1 Like

The issue does seem to be with set origin. When setting position to the same thing, there was no issue.

As for why it’s disappearing altogether, I think that could have to do with the fact that the text object is a blank text and therefore has an unknown width in the player.

Why that would cause the bug requires a brief explanation of how set origin actually works:

Set origin actually acts exactly like this:

The webplayer code literally sets the *center* position to your input plus half of its size in width (for x) and height (for y).

But because the text is blank (width is unknown), it then can’t make a calculation for half of width and half of height, and that causes the position to be unknown (not zero) so it disappears.

If you run the code I showed instead of set origin, you’d notice the position shift but not completely disappearing. That’s because width is still invalid but Hopscotch treats any invalid numbers in math blocks as zero. For set origin’s case, it’s directly calculated in the webplayer’s JavaScript and doesn’t catch the zero, so the final position becomes NaN (not a number). If it can’t place the object anywhere, I guess that’s where the bug occurs.

If you didn’t understand that or just don’t feel like reading, just know that (I think) it’s due to a blank text causing invalid numbers in set origin.