Jeu Tire sur la chauve souris – Etape 1 : Préparer la scène
Setting Up the Scene
Setting up the stage must be a piece of cake for you now! What matters now is WHICH backdrop should we select. Let’s select a wacky one.
At the bottom-right corner of the screen, You will see a purple button with an image and a ‘+’ sign. Click on the icon which says Choose a Backdrop. A list of backdrops will appear. The backdrop we want is titled space. Click on it. The stage will change to the space background.
Once you select the backdrop, you see the stage change from a plain white background to a grey sky with yellow stars and a planet with rings in the backs.
The stage is all set! Let’s now shift to other elements.
Bringing the Bat to Life
It’s time to bring in the prey, i.e. the bat. Bringing in a sprite must also be an easy task now, isn’t it? Just go to the library, choose the bat sprite, and click OK.
Don’t forget to delete Tobi! You don’t want to shoot him; neither do you want that he comes in the way!
Once you bring in the bat, go to the Costumes tab. There you’ll see four bat costumes; out of those four, we’re going to use the first two: bat-a and bat-b. This where the importance of animation comes in. In order to make the bat look alive, you must switch between the two costumes as rapidly as possible. How do you do that? You might have, by now, realized that PictoBlox already has the solution to all your answers. So, naturally, it has one for this question as well. To switch between the two costumes, there’s a block in the Looks palette known as the switch costume to () block. This block alone won’t work, though! You need to take care of the speed of switching as well! The speed will be taken care of using the wait () secs block. Let’s write the script.
- We need a place to start, so let’s introduce a hat block; this time, let’s use the when () key pressed Select the space key from the drop-down menu. You can select any key you want; keep in mind that whatever key you select, MUST BE the same for EVERY script you write for this game.
- Now, go to the Looks palette, and drag and drop the switch costume to () block below the when () key pressed block, and set the costume to bat-a. This block will ensure that the first costume is bat-a.
- Then, go to the Control palette and drag and drop the forever block below the switch costume to () block.
- Inside the forever block, drag and drop the wait () secs block. Then, drag and drop the switch costume to () block, and set the costume to bat-b.
- Copy the two blocks added in step 4, and drop them below the switch costume to () block inside the forever block; change the costume to bat-a.
What is happening inside the forever block? After EVERY 0.1 secs, the costume changes from bat-a to bat-b to bat-a and so on. Since the script is inside the forever block, it will be executed, well, forever, unless you click on the red octagon on it to make it stop. Therefore, when you press the key that you selected in the when () key pressed block, the bat will appear to be continuously flapping its wings.
Below is the complete script:



