🏠
Section 1.

Portal

Let's add a special place for the sprite to get to.
It will be a portal, to the next level, when there is another level.
Or to the end of the game when there are no more levels.

We can think of it as an open door.
It will look like a black rectangle.

Let's start by creating a new sprite.
Call it 'Portal'.
Draw a black rectangle.
Centre it in the sprite editor.

Decide where you are going to put it.
You may need to redesign your platforms.
Keep trying the game out.
It needs to be hard enough to be fun,
but not too hard!

Section 2.

When you are ready, add the code in the picture to the portal sprite's code tab.

My main sprite is called 'Avery'. In the 'touching' block, you will need to choose the name of your main sprite.

The code keeps checking to see if your main sprite has reached the portal.

When you reach it, it says 'You win'.

It uses a new variable to keep count of how many seconds it took to reach the portal.
It uses the join block to join 'You win' and the number of seconds.

For now, we are just ending the game.
When we have more levels, we will go to the next level instead.

🏠