im trying to make my own life system cause I’ve done It before but it crashes when it reaches 0 and I cant figure out why https://arcade.makecode.com/S54417-06884-67347-37321
It seems your Forever block is running right after the Splash block activates, which it simply shouldn’t be doing. You can fix this by putting an if <lifeblood =/= 3>... around it to stop it from running that code after the splash block happens.
@Richard, somehow these Forever blocks are still running after the splash block has pushed the scene, how come?
If you put a breakpoint on the Splash block, which is at the bottom of the Forever block just right of the On Start, you can die in the game to activate it and then ‘step’ after it. You’ll see that the Forever blocks still run once after the splash block runs.
it’s possible for that to happen if you pause inside the forever. for example:
that’s why when you’re doing something in a forever loop that pauses, it’s best to only pause once as the last block in the loop. if that isn’t possible, then you should have a variable like “splashOpen” that you can check after each pause to see if you should bail out.
They aren’t pausing inside the forever block that is running after the splash though. Maybe the “play song in background” blocks are pausing somewhere? But if that were the case you would see the next ‘step’ start after the “play song” block, and the next step starts right at the top of the Forever block, even after running a different Forever block. You can tell the scene has already been pushed because the “location” variable set to to the location of player1 is null after that block is run.
Breakpoint activates after purposely dying:
After pressing ‘step’ a forever block that doesn’t cause any errors runs (Splash dialogue still hasn’t appeared, though that may be a Debug Mode issue?):
Offending code runs, though I’ve fixed the issue with the extra If block, the “location” variable has been set to ‘null’, so the scene has been pushed:
Splash dialogue appears once the Forever loop completes.
Then a few seconds later a random bit of code that was in a “run after” block runs, but that isn’t important, just annoying.
I guess I forgot to ping @richard ![]()
Thank you so much for the help ![]()




