Step 1

The blocks for the finish line script

To finish off this level, we're going to add a finish line item at the end of your level. We'll script it so that it makes you go to the next level when you fly past it.

Find a game object you'd like to use from the Tappy Plane pack in the Game objects sidebar, and place it where you'd like the end of your level to be. Then right-click on it and select Add script.

We want this script to constantly check the x position of the player character, just like how we were checking the y position of the character before. We want it to figure out if the x position of the character is greater than the x position of the finish line object, and send the player to the next level if that's true. Grab these blocks:

When created (from Events) Set physics enabled to false (from Physics) Constantly (from Events) if (from Control) > ( = from Operators) x position of (from Transform) first instance by tag (from Sensing) x position of myself (from Transform) go to next level (from Control)

Have a go at arranging all these blocks in the workspace in the way you think they should work. Think about what we're trying to achieve with our finish line script. If you aren't quite sure, go to the next step to see how to arrange them.

results matching ""

    No results matching ""