Project: Playing with Potions


Ruairi from Kano here.

There are 200+ sounds and music to play with in the Harry Potter Kano Coding Kit. Here is a simple and fun way to play with sounds using the object collide block. This means two objects will make sounds when they touch.

Turn your speakers up!

Step 1

Let’s start by going to the Profile section and clicking on the New Creation button.

This opens the coding window, where you can make any creation from scratch.

Step 2

Click on the Background button under the canvas on the right. There are a whole bunch of Wizarding World backgrounds to choose from.

Select the Hogwarts Potions Classroom.

Step 3

Next, try building the code below. You'll find the green blocks in the Objects tray on the left. The blue block in the Control tray. And the pink blocks in the Wand tray.

This code will make 3 different potion bottles, a cauldron, and a Death Eater Dummy Wand appear on the canvas. Remember to copy the X and Y numbers shown below, so the objects don't stack on top of each other.

The blue block makes a loop. A loop is an action that tells your computer to repeat code.

This Every 1 millisecond loop tells your computer to set the position of the Death Eater Dummy Wand to the X (left and right) and Y (up and down) position of your coding wand. And set the angle of it to the Roll of your coding wand.

So as you move and twist your coding wand the small Death Eater Dummy Wand will move and twist on the screen.

Okay, these are all the objects we need, now we just need to make sounds with them.

Step 4

Add a Speaker part by clicking Add Parts, then clicking Speaker

This will add the Speaker code blocks to the left of the screen. This is where all the Harry Potter Coding Kit sounds are kept.

Step 5

Next, add the below blocks to your code space. You’ll find the blue collision block in the blue Events tray. The pink and yellow blocks in the Speaker tray.

The code says this: When the Death Eater Dummy Wand hits Potion Bottle 3 play the Glass 2 sound. But also set the pitch of that sound to 200 - which makes Glass 2 sound higher. The higher the number the higher pitched the sound, try it out.

Step 6

Next, repeat this code for the three different potion bottles and cauldron. It should look like this:

Changing the pitch of each object will make the bottles sound like they have different amounts of potion in them. Play with the numbers to see what happens.

Step 7

Now, try moving your wand and hitting the different potion bottles - they should make different sounds - some higher pitched and some lower.

Here is what your creation should look like when you’re finished.

What tunes can you tap with your coding wand?

Step 8

Don’t forget to click save, and share your creation to Kano World.

Mischief Managed.

Kano Profile: Ergellegre