Hi everyone,
One of the most exiting things of a program is that it can be interactive.
Any time someone clicks, tabs or types something at a computer or phone, that generates a event.
and there is some code that decides what to do when an event occurs.
For example, you could have an eventhandler that sais
"when the mouse is clicked, play a sound".
Let's try an activity to see how it works.
Have you ever heard of the game Flappy Bird?
By using eventhandlers, you can learn how to program your very own custom version of Flappy Bird.
The code you write involves dragging and dropping blocks, that represents commands for the computer.
Drag and drop programming is the easiest way to learn...
It's even how university students learn how to code.
But under the hood, each block is represented by real code.
If you take a look at the workspace, there are some green blocks that are filled in for you.
These are event handlers.
If you want the bird to flap, when you click your mouse, you can do this by attaching the flap-block to the appropriate eventhandler.
And now in your game, whenever you click your mouse, the bird will flap.
In each puzzle of this activity, we will introduce new types of events as green blocks on the work space.
and you can decide the appropriate block to add in responds of these events.
When you see a arrow like this, you can change the settings,
like the sound to play when the bird touches the ground.
In the final puzzle, you will be able to create your own game and share it with your friends.
Have fun!