About Virtual Flower Garden:
In this project you’ll learn how to create a virtual garden and fill it with colorful flowers.
When you run the project, a flower appears wherever you click the mouse. Scratch uses a simple ball sprite and a “stamp” block to draw each flower. The ball stamps an image of itself to create each petal, moving back and forth from the flower’s center each time.
Scratch Code For Virtual Flower Garden
Draw Flowers using stamp block:
To draw a simple flower with five petals, the loop runs five times, drawing a ring of petals centered on the ball sprite’s starting position. Each petal is a “stamp” image of the ball sprite.
Follow these steps to that creates a flower when you click on the stage. Once it’s working, you can reuse the script to make the special flower-drawing block.
Import the ‘ball sprite’ from the sprite library.
The ball moves in the current direction a little and stamps a copy of itself and moves back to the center.
It then turns to face a new direction. There are 360 degrees
in a full circle, so each turn is one fifth of a circle.
The “repeat” loop stamps five petals.
The “stamp” block after the loop makes the flower’s center.
Make a custom block to draw flowers
The next step is to turn the flower-drawing code into a flower-drawing block.
What if you want to draw lots of flowers? Instead of making lots of copies of the code, you will create your own custon block in Scratch and you can then use this block to grow flowers wherever you want.
Next, build a new script to use the “draw flower” block. When you run it, you can draw flowers with a click of your mouse.
Test it! Click around the stage to create a stamp of flowers.
Customize your flowers:
At the moment all the flowers you draw are exactly the same.
The real power of custom blocks comes when you add inputs to them to change what they do. To customize the flower, you can add input windows to the “draw flower” block, so that you can draw flowers with different colours, sizes, and numbers of petals.
Add extra inputs to change the number of petals, color of
the petals and the flower’s center.
Add two new blocks to set the petal and flower-center colors.
Now add extra inputs to change the color of the petals and the flower’s center.
You can make all your flowers different by using random numbers for each input in the “draw flower” block.
For more variety, insert a “pick random” block into the “draw flower” block instead of typing in the exact number and color of petals.
For a finishing touch, add a backdrop for your flower meadow. You can paint your own backdrop by clicking the paint symbol
to the left of the sprites list. Alternatively, click the backdrop symbol to load one from the library.
Now add a “clear” block to the main script.
Run the project and click around the stage to make a flower garden. Don’t forget you can press the space bar to clear the stage.
Download Project Virtual Flower Garden Files:
To download the project files of the project How to make Brick Breaker Game on Scratch Click here. Also go through the another exciting scratch 3.0 project of Brick Breaker Game on Scratch here,