Beginners Scratch – How to make an animated Christmas Scene

Because our last lesson on animation was cancelled, I thought I’d post a lesson online that the kids could access over the Christmas holidays. This Scratch project(Julie’s Christmas Scene) is on the Scratch.MIT.edu website user:cdathenry1516, pw:cdathenry if you want to download it to your computer.

Screenshot (3) I searched the internet for Christmas Cartoon Images and saved a few to my computer:Screenshot (14)

Once I had all the images I wanted for Sprites, I opened SCRATCH and imported the Sprites From File but I noticed that each Sprite had a white background that blocked my nice backdrop. I decided to delete the background from each sprite.christmas scene delete image background

I did this for all my sprites. Next I decided to make the dog wag is tail by

  1. Duplicating the doggie’s costume,
  2. using the select tool to select just his tail and then rotating the tail with the little button at the very top of the selection rectangle.christmas scene make tail wag edit costume

I did the same with Santa’s arm and his shoes. I just rotated them a bit in each costume, back and forth. christmas scene make santa dance edit costume christmas scene make santa wave edit costume

For the lights on one of the christmas trees, I just

  1. duplicated the tree costume 3 times,
  2. poured different colours into the round decorations in each costume.

Lastly, I scripted each of the Sprites like this:christmas scene snow flake script Christmas scene santa script Christmas scene doggie script

That last script is for the doggie! You can script your Sprites in any way you would like. Can you put in a snowman and make him dance about? or bounce around. Can you have presents dropping from the sky like my snowflakes??

Christmas Pizza Party next week!!! Don’t forget to wear a santa hat and decorations! Bring your favourite scratch project and we’ll show the rest of the Dojo!

Julie

ModderDojo Athenry Topic 6: JavaScript Operators and ScriptCraftJS Drone Functions

Operators:

Operators in any programming language are used when you want to calculate something new: they operate on values. variables, or expressions to produce a new value.

Since ScriptCraft is built on the JavaScript langauge, it uses standard JavaScript operators. As it happens, many other programming languages (including C, C++ and Java) use the same operators or very similar ones.

JavaScript Operators

Drone Functions:

As we have seen before, in ScriptCraft you use a drone to do your building for you. The drone has functions that are part of it.

Here are some of the main drone functions that are useful when building your mods:

ScriptCraft Drone Functions

You can find lots more about these and other functions in the ScriptCraft API Reference: https://github.com/walterhiggins/ScriptCraft/blob/master/docs/API-Reference.md

Example: Build a Pyramid

This example is based on a very nice program writing by Ruaidhri from Coderdojo Athenry last year, updated slightly because some ScriptCraft commands have changed in the meantime.


// Copyright Ruaidhri from ModderDojo Athenry,
// slightly updated by Michael and Alex.
// Builds a pyramid with entrance and lights inside.

exports.pyramid = function()
{
echo('making a pyramid');
var d = new Drone(self); // 'self' means start drone beside me
d.up(1);

d.chkpt('begin');

var size=31;

// Make the walls
while (size > 0)
{
d.box0(blocks.sandstone,size,1,size);
d.right(1);
d.fwd(1);
d.up(1);
size=size-2;
}

// Entrance
d.move('begin');
d.right(15);
d.box(blocks.air,1,2,3);

// Lights inside
d.move('begin');
d.right(4);
d.fwd(4);
d.up(3);
d.turn(2);
var t = 0;
while (t<4)
{
d.hangtorch();
d.left(11);
d.hangtorch();
d.left(11);
d.turn(3);
t = t + 1;
}
d.move('begin');
}