In last tutorial, we created an animation of a flying bat. In this tutorial we will learn how two sprites can communicate between each other.
Each sprite has its own scripting area, where the scripts are written perticularly for the parent sprite. For example in the last tutorial you had only 1 sprite, thus 1 scripting area and the script was created for bat.
When you want to have one sprite do certain action only when the other sprite commands, you have to use broadcast protocol. In this protocol, one sprite broadcast message and other sprite start a script only when the message is received.
In this project, there are two sprites, one cat and one bat flying. Whenever you press ‘Space’ button, the cat will say “Fly Bat”, then the bat will reply “Ok Cat” and will pick a random location in the sky and fly there.
Now, you project is ready and you start executing it using green flag. Tune the time and wait blocks for getting the best animation.