Scratch Beginners – Week 8- Stop Motion Videos

Last Saturday, we had a fantastic time creating very simple stop motion videos in scratch by taking pictures of small figurines in sequence and then uploading the pictures from cameras and phones to the computer. We then started Scratch and added the very first picture as a SPRITE from a file. All the subsequent pictures were then added as new costumes to this sprite!

We did have to do a very simple code for the sprite – when the GREEN FLAG is pressed the sprite FOREVER uses the NEXT COSTUME command and WAITS .1 seconds. The computer then moves from the first costume down to the last, very quickly, but not so quickly that we can’t see it happen! The result looks like we have taken a video. Check out the website for the demo that I used – Julie Animation. Search the site for cdathenry1516 games.animation code 2

Next week, we will take a look at,which is a drawing program. I will quickly go through the menus but the best way to learn a program like this is to use it and experiment with it. We will use it to try to delete the backdrop from some of our pictures that were taken last week to see if we can make it transparent. When we do, we will be able to see our own backdrops in behind our characters.

Please download the program from Please be careful of ADS. Only download from the recommended site. I will bring a copy on a belt.



Next week, the Moms and Dads should bring along a camera or phone along with the lead to download the pictures to your laptop.



PiDojo- Raspberry Pi News

This week was a very exciting week for us Raspberry Pi fans with two major  announcements from the Raspberry Pi Foundation.

  • The Raspberry Pi Zero
  • GPIO Zero

Raspberry Pi Zero

The Pi Zero is a fully fledged Raspberry Pi that measures 65mm x 30mm x 5mm and only costs $5. It has the same chip as the Model B that we use every Saturday but it’s clocked to 1GHz (40% faster than Raspberry Pi Model B) .


It will be really useful for what we’re trying to achieve at PiDojo due to it’s size and cost. We will be able to leave our projects assembled when we are finished building them due to the low cost of replacing the Raspberry Pi.


A new Python API for Physical Computing

The idea behind GPIO Zero is to make using the GPIO pins easier. It provides simple interfaces to everyday components like LEDs and buttons, to make playing around with common components much more accessible. It’s designed with education in mind, to help teachers and kids get going with physical computing without the friction of worrying about pull ups, edges and all the setup. But most people will find it very handy. So we should be able to code our projects easier and with less code.

For more information on the Pi Zero click here and for GPIO Zero click here.


Some of the PiDojo Ninjas got their Measuring Devices working and we will continue debugging the rest at our next session. There will be no PiDojo next week so the next PiDojo session is on the 12/Dec/2015 and if the Components I have ordered arrive we will start building Robots. Here is our code from today.

Beginners Scratch – Week 7 – Breakout

***Next week we will be doing Animation! Please bring any miniature figures that you might want to use to create a short story through stop motion photography. We will also need some way to take photos and download the images to the computer – so parents need to remember a camera and download cables. I will bring a big load of modelling clay.***

Breakout is a variation of our previous game, Paddleball. We create a new scoring experience for our gamers by introducing blocks at the top of our screen that they get points for hitting.

CDA-S5-Challenge_04-Breakout-game view

Everyone already knew how to import or create the first two sprites – the paddle and the ball and most coders remembered from paddleball how to get the paddle to forever follow the mouse in only the x-direction. CDA-S5-Challenge_04-Breakout-paddle control

The code to move the ball was essentially the same as in the paddle ball game with a small change to broadcast the starting position to itself.CDA-S5-Challenge_04-Breakout-ball control 2

We then created two variables, one for the score which will go up when the ball hits a block sprite(can you copy this code from the Paddleball game code and use it in the ball sprite?) and one for lives which will go down every time the ball touches the end line we added under the paddle on the Backdrop. Can you figure out where to put the code to reduce lives by one when the ball touches a certain colour?CDA-S5-Challenge_04-Breakout-variables

Lastly, we created the block sprites and coded for them to fade away when they touched the ball. We use the EFFECT block of code in LOOKS.CDA-S5-Challenge_04-Breakout-brick script

The complete set of notes in .PDF format can be opened here:CDA-S5-Challenge_08_Breakout. You can play with my completed game on the webpage. If you sign in as cdathenry1516 and use the password: cdathenry, you will be able to play all our games. If you have your own sign in name, just search for cdathenry1516 and you can see and play them all as well. Please put yours up there as well!CDA-S5-Challenge_04-Breakout-save to website

See you all next week!




Unity – Week 7


This week we started with a very short demonstration of some additional C# concepts, building on what we’d done last week.

After that, we continued with Roll-A-Ball.

We quickly finished off our walls and moved on to the Pick Up objects.

Pick Up objects are small cubes that float over the paying surface and that rotate to catch the user’s attention.

We added one Pick Up object and made it rotate. After that, we made it a “prefab”. Setting a property on one prefab object will automatically replicate that setting to all other prefabs of the same type. We didn’t take advantage of that this week, but we will next week.

We duplicated our Pick Up object and arranged twelve of them around our playing surface.

Next Week

Next week we’ll hopefully have enough momentum to finish off Roll-A-Ball completely.

After that we will start on some terrain modelling basics.

To be ready for terrain modelling basics, please be sure to have imported the standard assets package into a new empty project in Unity. To do this, follow these steps:

  1. Open Unity and create an empty 3D project, call it “Amazing Racer”
  2. Under the Windows menu in Unity, open the “Assets Store”
  3. In the “Assets Store” look for the “Unity Essentials” category
  4. Under “Unity Essentials”, find “Standard Assets” and import them

This process takes quite a bit of bandwidth and time, so you will need to have this done before coming to Dojo next week.

See you all then!

Advanced Scratch Platform Engine part 1

Hey folks,  today we started on a platform engine that can be used as the basis for many games.  Mostly today we were trying to get the physics of it fairly right.  We had to solve a lot of problems to make it work the way we wanted it!  This involved:

  • figuring out how to do realistic gravity!
  • letting us bump head off platforms
  • sorting out the “pillar” problem where we pop to the top of pillars
  • jumping
  • walking up slopes
  • using hitboxes to avoid snagging our whiskers on ledges


Hold onto the project as we will come back to it and add some enemies and maybe build it into a game!

The full instructions for the project are here:

You can download the code here!  (Note to download the code, click on “View RAW” and it will get downloaded to your computer).

Beginners scratch week 6 – Pen Commands

Since we had a terrific guest speaker today, there wasn’t enough time to rework our paddle ball game to the famous breakout game, so I picked out the quick (but really neat) drawing game! The .pdf of the slides can be found here:CDA-S5-Challenge_08-Pen Command-CDA-S5-Pen Commands CDA-S5-Pen Commands-code

In order to make it easier to change the values that control the angles of the drawing and the length of the sides, we created variables that we could change via sliders on the STAGE (right click on the variable on the stage after you create it and a menu pops up giving you some options, including a slider option). CDA-S5-Pen Commands-slider variablesReplace the handwritten numbers in the TURN and the MOVE motion commands with the variables for speed and degrees. When you touch the green flag and start the movement of your sprite, you can slide the sliders to get the perfect (or craziest) drawing! Duplicate your sprite and get several sprites drawing at once.

One extra bit that we didn’t get to is to use buttons to start and stop our drawing. Create two new button sprites and script them to send a broadcast when clicked. CDA-S5-Pen Commands-buttons

Just edit the script in the drawing sprite by putting the WHEN I RECEIVE event command at the top of the drawing script and select the START broadcast. Add another bit to the drawing sprite to STOP ALL when it receives the STOP broadcast from the Stop button.


Next week we will do the breakout game and we will plan the animation project for the following week.

Don’t forget to upload your projects to the website:! Put it on your own login and share it or put it on ours: cdathenry1516.

All the best,






Scratch Advanced – Gravity


For the last two weeks we have been learning about Gravity and building a lunar module project to simulate how gravity works in the real world.

What is Gravity?

Gravity is what holds us down on Earth, if we jump up in the air, gravity will pull us back down.

If you want to break free of the Earths gravity you have to travel very fast and reach “escape velocity” this is about 25,000 mph.

The space station, even though it is travelling at 17,150 mph (that’s about 5 miles per second!)  has not escaped the Earths gravity, while it is trying to travel away from the Earth at 17.150 mph gravity is pulling it back down, this makes it travel around the Earth in an Orbit.

So we set out to build a Gravity simulation game.

In order to make it a little easier we decided to use the Moon as our base as the gravity is less and there is no atmosphere to slow us down when we are moving.

Some of the rules that we had to code for were:

  1. Our spaceship should not move if it is on the Ground.
  2. The higher it gets the faster it should move – Less Gravity.
  3. If it starts moving left or right, it should stay moving until it is stopped – No Atmosphere.

The Sprite needed 4 Costumes:

  1. Landed – This is the default costume where nothing is happening.
  2. Up – This costume has a flame coming out the bottom.
  3. Left – This costume has a flame coming out the right hand side.
  4. Right – This costume has a flame coming out the left hand side.





Once we had the sprite built we started on the code. We started with the left and right code first, basically when you clicked on either the left or the right button, we would change the costume and also increase or decrease a variable to indicate how far we should move along the X axis (this is the one that goes from left to right).

We used a variable for the LeftRight movement to make it simpler. This ended with some code that looked like this:

LeftCodeAnd for the Right Arrow Right

We put a small delay in as well, this gave the effect of the thrusting going on and off which looked more realistic.

The left right movement was taken care of by a separate piece of code that just keep moving the Sprite.


This also had a little bit of code to stop everything if we touched a particular colour, this was the colour of my landing pad.

For the Up Code we did something similar, but had to add in the movement in as well.


To calculate the Up/Down movement was a little more complicated as we needed to adjust how much we moved up depending on how high we were, basically the Y value. Scratch doesn’t help here as the Y value goes from -180 to 0 and then on to +180, we needed it to always be positive, so we had to use a variable and add 180 to it.

The other thing we had to do was find a number that when we divided by the Y value it gave us a reasonable value to move the Sprite by, through trial and error this came out at 200.

Which ended up with some code like this:

Main1This code also has all of the initialisation code, where we set all the variables we are using to their initial values. Notice that the UpDown default is 1, this is to ensure that the first time that you press the Up key that the spacecraft actually moves.

And if you want all of the code, here it is


And finally this is what my Project looked like in the end


Unity – Week 6


This week we had a short session because of the fantastic demonstration that Colmac Robotics were kind enough to give us.

Following feedback from a few ninjas and ninja parents, I decided to do an impromptu session on the C# language. I had hoped that we’d perhaps just try to pick this up as we went along, learning through practical examples, but it was clear that the transition from visual languages to code-based languages was tough for some.

We used MonoDevelop to create a simple test application. Originally I had intended to use Visual Studio, but some people have had installation problems with it. I encourage everyone to re-install Unity at home when they have time, so that we can all standardise on Visual Studio in the near future.

Concept of Classes and Basic Structure of A C# File

I ran over these topics quickly again, but they were covered in last week’s post. Please do review it if you didn’t get a chance to read it before. It can be found here.

Simple Test Application

In our test application, apart from reinforcing the basic concepts mentioned above, we also touched on number of other concepts:

  • We looked how the class definitions in our files are blueprints for how the class is structured and operates. We never actually have a copy, more commonly known as an instance, of that class until we actually create one ourselves with the new keyword.
  • We discussed class constructors, the special method, with the same name as the class itself, that is called when we make an instance of that class.
  • We saw how Console.WriteLine() can output text to the Windows console.
  • We created a class called Shape. We said it was abstract; which meant that we would never be making an instance of the Shape class itself. We would purely be using it as a base for other classes.
    • We said that Shape had a public method called Area(). We made its return type double, but we also marked it as abstract and provided no body for the method. This meant that we were saying all classes based on Shape would have to provide their own version of Area(), but that Shape itself had no definition for it.
  • We defined a class called Circle. We made it so that it was derived from Shape.
    • We gave it a property called Radius of type double and marked it public.
    • We used the override keyword to make our own Circle specific version of Area(); “override” meaning that we were over-riding or replacing the method definition from the base class (Shape).
    • We provided a means to set the Radius property through an optional argument to the constructor method Circle().
  • We defined a class called Square. We made it so that it was derived from Shape.
    • We gave it a property called Length of type double and marked it public.
    • We used the override keyword to make our own Square specific version of Area(); “override” meaning that we were over-riding or replacing the method definition from the base class (Shape).
    • We provided a means to set the Length property through an optional argument to the constructor method Length().
  • When writing our Circle.Area() and Square.Area() methods, we saw how the built-in Math object has lots of useful mathematical properties and methods. We used the property Math.PI and the method Math.Pow() (to raise a number to a given power) to perform our area calculations.


In the end we had a small sample program that could defined instances of circles and squares, calculate their areas and output the results to the console window (command prompt window).

On-line Resources for Learning C#

If you want to brush up on your C# skills, outside of our CoderDojo sessions, there are a number of useful on-line resources:

  • An on-line tutorial for C# which lets you build and test code right in a browser window
  • Another on-line tutorial for C# which also lets you build and test code right in a browser window
  • Microsoft’s vast library of C# related resources including tutorials

Next Week

Next week, we’ll be taking a few minutes to close off this sample application, so that we can quickly illustrate a few outstanding points, and then return to roll-a-ball to, hopefully, close it out. See you next week!

PiDojo – LCD Display


Today we used a 20×4 Alphanumeric LCD Module to output information from our Raspberry Pi. These modules are cheap and easy to interface to the Raspberry Pi. We only need to use 8 pins on our Pi leaving loads of pins to connect input devices to.

We used Matt Hawkins’ LCD Test script to test our displays. Then we imported some code from that script to write some jokes to our displays. We will finish off these next week and we will start working on code for an ultrasonic distance sensor.

You can view our code on Dropbox and here are my slides from this week LCD_Display