In this tutorial you will learn how to program a catching game using the inclination sensor of your smartphone!

Download the tutorial in PDF-format here!

The finished game to start playing right away:

download.png

 Game

If you get stuck or need help, check out the tips in the next section. 

1. Create a new project. You need an object (for example, an easter egg) that the player has to catch.

step1.PNG

2. Now add the bricks to your script step by step.

step2.PNG

3.  Now you need a object to collect the things falling down (for example a basket). Proceed as in step 1.

step3.PNG

4. Now you have to check in the script of the egg, if the egg was also caught with the basket.

step4.PNG

Tips

Tip1: When you start the game, you can display the axes to see which values would suit you.

For the x-axis you can choose a position between -450 and 450 and for the y-axis 500. You can find the random value generator under "Functions".

tip1.PNG

Tip2: Tap on “new..." to create a new variable.

tip2.PNG

Tip3: You can find the sensors, in our case the inclination of the phone, under "Sensors".

tip3.PNG

TIPP:
You can also read the LernCards to learn more about loops, queries and variables or try the extension to make your game even better.

Extension

1. Do you want the basket to be full after a certain number of points?

Then you need to add a new look to the basket.

e1.PNG

2.  To change the appearance now, you need to insert a query in the "Repeat Continuous" loop.

e2.PNG

3. You can also insert several looks in the eggs and let them alternate.

e3.PNG

e4.PNG

Do you have any more ideas to improve your game? How about making the speed of the falling eggs faster and faster (using a variable). Or add broken eggs, for which the player gets minus points when catching them.

Try it yourself and improve your game more and more.