top of page

Indian Flag Hoisting On Scratch

Updated: May 1, 2023

In this blog, we will hoist the Indian Flag with National Anthem by writing the code in the scratch editor. This Project is made and written by Ansh Agarwal of Grade IV From The Kalyani School, Pune.


So first, to see the preview of the animation below click on the flag icon and read the complete blog to make your own animation.



We will make this project by dividing the task into the two-part:

  1. Stage Decoration

  2. Coding

First we will decorate the stage with the sprite and with the background and then we will write the code to make the animation 🙂.


Stage Decoration: For the stage decoration first, we will decorate the stage with the sprite and then we will add a backdrop OR background.

  1. First, you need to make a flag for that click on the Sprite button and go to the draw button.

  2. Now make a flag with curves and put 5 costumes to make it look that it is swinging and add a brown stick as well.

  3. Then make one more Sprite by adding the given objects like squares, circles, rectangles to make the person and paint it with colors whatever you want

  4. Now put 5 costumes so that it looks like the person is moving the hand to salute.

  5. And now we will add a backdrop or the Background

  6. For this from the internet, find the image of the Indian flag and snip it and save it in the Document file.

  7. To put the background, go to the Background option and then click on the Upload button.

  8. When you see your document screen, click on the image which is saved and the background will be made.

Coding: We will write the code to make the animation

  1. For the coding of the swinging flag, first, drag the ‘when flag clicked’ block from the events section.

  2. Then from the control section, drag the block ‘wait 1 second’ and then change it to ‘wait 2 seconds.

  3. Go in the sound section, click on the sound+ option, and then click on the record option.

  4. From the internet, select the audio of the National Anthem, and click on the red button and immediately start the audio in full volume. After it is recorded, rename the voice as ‘National Anthem’.

  5. Now click on the code option, go to the sound button, drag the first block, and put it after the ‘wait 2 seconds’ block.

  6. Go to the Looks button, drag the ‘switch costume to’ whatever you renamed the flag sprite, and put it inside the forever block.

  7. Go in the control button, drag the ‘wait 1-second’ block and change it to 0.5 seconds and put it below the ‘switch costume to’ block

  8. And repeat the step five times and change the costumes every time to a new ‘switch costume to’ block.

  9. For animating the man that you made, go to the events button, and drag the ‘when flag clicked’ block and go to the Looks button and drag the ‘switch costume to’ whatever you renamed the man sprite and put it below the ‘when flag clicked’ block.

  10. Go to the control button, drag the ‘wait 1 second’ block and change it to 0.5 seconds and put it below the ‘switch costume to’ block.

  11. Repeat the STEP 10 for 5 times and change the costume every time to a new ‘switch costume to’ block

  12. Your coding is completed. Just click on the Green flag to start the animation project.

For more you can refer to the below 👇 link for more help or to remix my project, Thanks.

And if you're remixing my project, don't forget to add your project link in the below comment.


Still if you're facing any problem during making the project then you can ask your questions in the comment Box.


Made and Written By:

Ansh Agarwal ,

Grade IV,

The Kalyani School, Pune.

300 views0 comments

Recent Posts

See All
bottom of page