I am working through the tutorial for Floor is Lava game. When I fall onto the reset zone and my player returns to start, I would like to code the platform to restart its pattern of movement. Right now, the code continues through the movement of platforms.
Hi Deann_Poleon,
If you aren’t doing things like checkpoints, you could use the “Restart Scene” CoBlock to reset the whole scene. That would move the player back to start and all the platforms back to their original positions.
Alternatively, you could add some lines of code to move the platforms back to their starting XYZ Coordinates when the player collides with the lava. This is trickier though, because you will need to make sure that the code that moves the platforms doesn’t continue to move the platform after it is teleported, causing it to be in the wrong position.
A solution to this could be to use a variable to check and see if the position of the platforms needs to be reset. If the player falls, set the variable to a value, and have your loop controlling the platforms check for that value. If it exists, move the platform back to its starting point and start the code over. You can separate your platform code into smaller blocks of “if” statements, to check more often if the player fell in lava.
Please let me know if you have more questions!
Thank you so much for all of the suggestions. I will try them out with my students tomorrow. Thanks!