Scratch games making tutorial 146c

Path finder - advanced

In this tutorial you will fix a bug in the "Path finder - intermediate" game.

 

Complete these steps ..

 

1. If you have not done so already, complete the 146b Path finder - intermediate tutorial first, and then return to this tutorial.

 

 

2. Open your completed Path finder intermediate game.

Press B to begin the game and then double or triple-click (spam) a path to rotate it. You will see that it does not always turn to 90, 180, 270 or 360 degrees. Sometimes it gets stuck at an odd angle.

We can fix this by adding a script to each path. Start with "Path 1" and add this script ..

This script will ensure the path always rotates back to either 90, 180, 270 (-90) or 360 (0) degrees. However it creates another bug which we can fix by changing one of the existing path scripts.

Find this script on Path 1 ..

 

You need to change the "turn 9 degrees" angle in the script from 9 to 8 like this ..

 

Go full screen and then press the "B" key on your keyboard to test your Path 1 scripts. You should be able to double or triple-click the path and it will always return to 90, 180, 270 or 360 degrees.

Press the "E" key to end your game and continue working on it.

 

 

3. Use "File>Save as" to name and save your game. Name it "Path finder advanced" ..

 

 

4. Copy the new script your created in step 2 above to Path 2. This path will be turning by -9 degrees when clicked. Change this to -8 and also change the turn script block in the new script from 1 to -1, like this ..

 

 

5. Continuing copying the new script to the other Path sprites and edit the existing turn script in each.

When you are done, go full screen and then press the "B" key on your keyboard to test all your paths. You should be able to double or triple-click each path and it will always return to 90, 180, 270 or 360 degrees.

Press the "E" key to end your game and continue working on it.

 

 

6. Use "File>Save" to re-save your game ..

 

 

7. There is a second bug that needs fixing. At present it's possible for a player to press more than one arrow key at a time sending the Cat onto the black background. To fix it you must edit the Cat scripts which control its movement.

Select the Cat sprite and find this script ..

 

You need to replace it with these two scripts ..

 

 

8. Use "File>Save" to re-save your game ..

 

 

9. Well done, you've fixed the bugs. We can't find any more bugs. Are there any more you can find and fix?