In this lesson, you will create a fun and interactive fish tank on your computer.
You will learn how to make a fish follow your mouse pointer and create copies of itself when clicked. These copies, or 'clones', will swim around at different speeds and sizes, just like real fish in a tank. So, are you ready to dive in and start coding your own fish tank? Let's go!
Open the Scratch website and create a new project. Delete the cat sprite from the project.
Go to the Scratch website using the link below and click on the 'Create' link in the blue bar at the top.
By default, each new project starts with the cat sprite already added. To delete the cat click on the x in the blue circle beside the cat in the sprite list.
First, go to the backdrop library and select the Underwater 1 backdrop. This sets the scene for our fish tank.
Next, add the Fish sprite from the sprite library to your project. This will be the main character of our game.
In this step, you will make the fish follow your mouse pointer. The mouse pointer is the arrow or hand that moves when you move your mouse. Wherever you move your mouse, the fish will follow. This is done by using a loop that continuously updates the fish's position to the current position of your mouse pointer. Here is the code you need to add:
when green flag clicked
set size to (50) %
forever
go to (mouse-pointer v)