Happy holidays! Tis’ the season to be merry and bright and also the perfect weather for a cup of hot chocolate.

Who doesn’t love all of the twinkling lights and decorations this time of year and, of course, the presents under the tree (especially the surprises!). 

It’s been a little harder to shop for gifts this year, but that gives us the chance to get creative. If you want to learn how to code, there happens to be plenty you can gift without leaving the house. For you, we’ve created a codable Scratch gift that you can personalize and share with someone you care about. 

Code your own Holiday Advent Calendar in Scratch and slowly reveal gifts, goodies, or games to your family and friends.

Our advent calendar counts down until Christmas, but you can make yours for any holiday or special event. It’s a fun way to keep in touch and give a gift that comes from the heart.

Put on your matching pajamas, and let’s get coding!

See Complete Holiday Advent Calendar

Complete scratch holiday calendar

What you need:

  1. Scratch accountCreate a free Scratch account 
  2. Starter template: Use this Scratch starter template as the basis of your project. View starter template

No coding experience necessary for this tutorial. Beginner-friendly for ages 8 and up. Give it a try!

Banner for fall coding classes

Step 1: Remix the starter project

We’ve set up the base files for you. Instead of creating a new project, start by remixing a project.

Step 1 scratch holiday calendar

Hint: You can personalize your calendar with your own background and sprite images.

Step 2: Add a gift for December 15

Our advent calendar starts on December 15. Let’s first add code to the date that tells our gift sprite what gift to open.

Step 2 scratch holiday calendar

Hint: Instead of a card, you could show an image, animations, or even start a game when you click on the date.

Step 3: Show the December 15 gift on click

When we click our calendar date, we want to reveal the gift. You’ll see some code added to the gift that hides it when we start our game. Let’s show the gift when we click. 

Step 3 scratch holiday calendar

Step 4: Hide the gift after you view it

The gift shows now! To close it, click on the sprite. The gift covers the whole page so anywhere you click will hide the gift.

Step 4 scratch holiday calendar

Hint: You could also show the gift for a specific amount of time by using the wait block. 

Step 5: Add logic to lock the future gifts 

Currently, we are revealing the gift when we click our calendar. Let’s add an if-else statement to help our code decide if it’s time to reveal the gift yet. If it is too early, we’ll show a message instead of our gift. 

Step 5 scratch holiday calendar

Reveal the gift only if the current date is after the reveal date:

Step 5 b scratch holiday calendar

Hint: For each calendar date sprite, you would change the value in the > block.

Step 6: Show an error when you try to open future gifts

Step 6 scratch holiday calendar

Hint: Our error message is an image sprite, you can also upload or draw your own message.

Step 7: Hide the error message after 1 second

Step 7 scratch holiday calendar

Hint: Add a sound to your error message, using play sound block, as a warning!

Step 8: Add another gift on December 16

Step 8 scratch holiday calendar

Step 9: Show the December 16 gift on click

Step 9 scratch holiday calendar

Step 10: Repeat until complete 

For each date in your advent calendar, repeat steps 2 through 9. 

Step 10 scratch holiday calendar

Your advent calendar is complete!

See Complete Christmas Advent Calendar

Complete scratch holiday calendar

You can “see inside” my completed project to get the full Scratch code for this activity. 

Got stuck building your game? Join our Facebook group to get help from teachers and other students plus BONUS step #11.

Take the time to personalize a calendar for your friends and family and give them a gift created by you. 

We want to see your Christmas advent calendar too! Share your project in our Facebook group or use #CodeWizardsHQ and #NowYouCode to show us your calendar and prizes. 

If you want to build more games in Scratch, check out our Elementary School Coding Program. It’s the most fun and effective way to learn Scratch coding and eventually real-world languages like JavaScript and Python.

We wish you all Happy Holidays and a Happy New Year.