Restart scene in CoBlocks

I tried the restart scene block today and everything reset except some code that was inside a forever loop. Is there away around this or do we need to avoid restart scene if the code requires a forever loop? Thanks ! Here is a link to the space

Copy the same scene first, Add an events “When …is clicked” to start new secne.

Press new game for restart

Hi @MBridges,

Thanks for pointing out this issue! We’ll fix the behavior of that block to properly restart the scene with our next release :slight_smile:

Thank you for the suggestion. I’d prefer just one scene and think I’ve come up with a workaround - will post below. :slight_smile:

Thanks, @Stefan! I found a workaround using a boolean variable. I’ve updated the code.

I appreciate the team will address this in the next release! The only reason I want this loop to stop is because it’s been triggered by a “when clicked”. Without such an event, I imagine one would want the forever loop to execute. (For instance, a Parkour scene where moving platforms start at the beginning of the scene.)

@Stefan, I just added a play sound block inside of the “when T-rex clicked” loop. It plays just fine but since it’s longer (20 seconds) it continues to play after reset has been clicked. I added a stop all sounds block at the end so it’s fine but thought I’d mention it in case you’d prefer to have the reset block include this function thereby eliminating the need for the additional stop sounds block. :slight_smile:

1 Like

Hi @MBridges,

I’m glad you found a solution to your particular issue.

The current “restart” CoBlock behavior is certainly not intended, so we’re fixing it to work just like you imagine it would :slight_smile:

1 Like

Chances are you found or will find out that physics also don’t reset properly but I figured I’d mention it just in case. I had to add a “remove physics” block work properly. :slight_smile:

image

1 Like