Dragging When Events Doesn't Work (But Appears To)


Hi @Liza @awesomeonion @Rodrigo

Since THT is working on squashing some bugs, perhaps you could try to addres this one as well.

Drag & drop is really handy for blocks & objects. But for events, the relative positions appear to be changed, but they’re still executed in the original order & upon exiting and returning the events are back to their original positions.

For some projects the order the events are created in may not matter, but for others, the order is very important. This bug causes users to believe the order has been changed when it really hasn’t.

Here’s a simple example:

This order makes the heart red (since during each “frame” the blocks of the 2nd event are executed after those of the 1st event)

So now we drag & drop the 2nd event before the 1st

This shows the order has changed.

But it hasn’t! The heart will still be red. Exit the project and return. The event order will be as it originally was since it was never really changed.

To permanently change the order, you have to cut & paste them. Try that to swap the events and you’ll see the heart is then green.

TBSr's General Hopscotch Coding Topic
We're making Hopscotch faster on older iPads

That is a weird bug, and my iPad won’t load any projects unless they are created on another device, so I think that I unfortunately can’t try to replicate this bug.


Both of the When game starts blocks are running at the same time so the program just chooses one of the colors. If You switch the order of the blocks it may change the color or stay the same.


No, that’s not how it works.

Just leave the events in the order they were created and switch the Color blocks. You’ll then see that the color set in the 2nd event is always the result. During each frame, blocks of the second event are executed after blocks of the first event. Because this is an intra-frame order of execution, you don’t even see the first Color block make it’s change.


If you have a code with two when game starts one with move forward 100 and one with move forward -100 the object will not move forward and then move backward but, it will stay in the same place because the commands run at the same time and counter act each other.


Close, but the commands aren’t processed at exactly the same time. I can see how this must be confusing.

The player is actually processing

  1. The object should move forward 100
  2. The object should move forward -100. The total move forward to render is now 100 - 100, so move forward 0

If you changed your example to two When Game Starts, the first with Move Forward 300 and the second with Move Forward -400, what would it do? It processes both and executes the Move Forward with the sum of -100.

But the point is that the player is processing both sequentially (one after the other), even if it doesn’t render (display) the result until it has processed both.

This is easier to understand with variables

You suggest the that color is not set to red because both Set Xs happen at the same time and the 2nd Set X “wins”. It can be shown that, in fact, X is first set to 1 and then set to 2 by changing the code (Note, this is different than when the player did not render the Move Forward result until it had the total)

To show that both Set Xs occur, cut & paste the When events so they’re now in this order:

Now the heart does turn red! Why? Because the blocks & events are executed sequentially

Ok, so why did I specifically say to cut & paste to change the order. Well, that was the whole point of my original post. If you had just dragged the events to new position, the code would temporarily look the same, but the order of execution would not have changed and the heart would not turn red! And after closing and reopening the project they’d go back to their original order.

@Liza @awesomeonion @Rodrigo

I hope the confusion demonstrated by just one Hop shows why this is important to fix.