Student Subscription site screenshot Subscribe now

Subscribe to our Student Site to access all of our Games Coding Lessons for just £8 per month


Scratch games coding lesson 79

 

Portal - advanced

A portal is a magic doorway to another place. We're going to make a game in which the Cat disappears when it touches a portal and then re-spawns somewhere else on the stage. We'll also create animations to make the effect more realistic.

 

NOTE: You must use Scratch 3 or higher.

 

Complete these steps ..

 

1. Open Scratch, OR create a new game (from the top menu choose File > New).

 

 

2. Download, save, and the load this game file into Scratch ..

 

 

 

3. Select the Stage.

Add this code ..

 

 

4. Select the Portal sprite.

Now add this code ..

 

Lets make the Portal pulse.

Add this code ..

Press B on your keyboard to test your game.

When you are ready press E key to end your game and continue working on it.

 

 

5. Select the Spawner sprite.

The Cat will emerge from this sprite after it enters the portal.

Add this code ..

 

Now add the code to make it appear at a random position on the stage, before disappearing after the Cat emerges from it ..

You cannot test this code yet.

 

 

6. Select the Cat sprite.

Add its properties code to prepare it for when the game begins ..

 

Now add the code to allow the player to move the Cat around the stage when the arrow key are pressed on the players keyboard ..

Press B on your keyboard to test your game.

When you are ready press E key to end your game and continue working on it.

 

Now add the code to make the Cat disappear when it touch the Portal and reappear at the spawner sprite ..

Press B on your keyboard to test your game.

When you are ready press E key to end your game and continue working on it.

 

 

7. Use File > Save to your computer to save your game. Name it Portal advanced v1.sb3

 

 

8. Well done! You've finished this lesson.