The code is written in Scratch version2 but will work with Scratch3. At each stage you can download the completed code or you can start at the first download and add the code yourself at each stage.
Santa Program
Making Santa Walk
Santa is a sprite with many costumes or images. Changing costumes makes Santa look like he is walking. We use a wait to slow down or speed up the speed at which he changes costume. This can make him walk faster or slower. Here, i wait 0.01 seconds and then I change it at the end of the video to 0.05 seconds. Here is the code for the Santa Sprite. You can change the backdrop if you want.
|
You can download the file here.
|
Making Santa Change Direction
We want Santa to change direction. We can do this by checking where Santa is and checking where the mouse pointer is. If the mouse is to the right of Santa we make him face right and if the mouse is to the left of Santa we make him face left. Xposition is where Santa is and Mousex is where the mouse is. Code ( We add this to the Santa Sprite. We now have 2 pieces of code in the Santa sprite) |
|
Adding Snow
To add snow we create 2 sprites, snow1 and snow2. The code shown below is added to snow1. Copy the code to snow2 but make one change, set y to 170. So y is 170 in one and -170 in the other. In the forever loop the in the change y by -5 is the speed of the snow. We can change this to make it snow faster or slower, but it must be the same for snow1 and snow2. |
|
Making SnowThis video explains how to create the snow sprites in Scratch. You create a new sprite, fill it with a colour, then draw the snow flakes and finally remove the background colour. The snow sprites move down the screen and when they reach the bottom they go back to the top, over and over again.
|
|
Moving Santa
If we want Santa to move around then we must change the Santa code by adding Move 2 steps in two places. |
|
More to follow. ( 7th April 2020)