Scratch Advanced – Week 16 – Stop Motion Animation

We are going to revisit one of the topics we did earlier in the year. Do you remember The Movies, where we had the spinning wheel looking like it was going backwards?

Well we are going to do something similar over the next couple of weeks, where we will investigate and use Stop Motion, this is the same movie making technique that the Wallace and Grommet Movies are made with.

So what are we going to learn, well, we are going ot use a lot of techniques we have used before, so it is more a case of what are we going to re-learn.

  • Broadcasts – to make our code smaller and neater
  • Variables to simplify the code, specifically local variables.
  • Speech Bubbles.
  • Program Flow, there are a lot of things that need to happen and we need them to happen in the right order.

We are going to animate The Three Little Pigs and the Big Bad Wolf.

As you know this is a little story and in stories, things happen one after the other, so that is what we need our code to do as well, there is not much point having everything running from a Green Flag, we need some way to control the flow of the Program.

First we are going to need some Sprites though.

  1. A Wolf
  2. Pig One
  3. Pig Two
  4. Pig Three
  5. Straw House
  6. Wood House
  7. Brick House

As you know my drawing skills are excellent, so I have come up with the following:

Sprites

Nice aren’t they. I’m sure you can do better.

When the Story starts there is only the Wolf, One Pig and the Straw house visible, so all the others need some code under a Green Flag to get them ready, backstage, ready for when it is their turn in the story.

The Wood House for example has just a HIDE under the Green Flag, you will need to determine what each Sprite will need under a Green Flag control. Basically anything to get it ready for the story.

On to the Stop Motion Animation.

Stop Motion is where something is moved a small bit and then a picture taken and then moved another small bit and another picture taken, until the figure has moved to where it needs to be.

We are going to do something similar, where we will set up the x and y position of the Sprite in local variables and then get another piece of code to do the actual moving, this helps to make the code a little easier to read as it splits it into smaller sections.

Here is the code for example that one of Pigs uses to move to the next House

Pig2

You can see how I have split it into smaller pieces and that I have used local Variables to set the x and y positions.

You will need to figure out where on the screen you want the Sprites to go and how fast you want them to go there, that will determine the numbers that you need to use when you are SETting the xPosition and yPosition variables.

As the Wolf is kind of the main Character in the Story, we control everything from his Sprite. We do one thing after another and if we need to wait for something else to happen we use a Broadcast and Wait, this will control how the code flows from the top to the Bottom.

Here is all the code for the Wolf Sprite

Wolf

Now, my code is very scrappy, there are a number of BUGs that need to be sorted out, for example when Pig One moves to the Wood House and the Wolf comes over, the Speech Bubble covers the Pig, this should be changed really.

At the end of the day, you can make your Story as simple or as complex as you like, one thing that I can tell you though, is that the more time you spend on the project the better it will end up.

You can also do real Stop Motion with a Camera and Lego, you can then import the different pictures into Scratch as either Stages or Sprites.

I did one as Stages which is up on the Scratch Web Site and here is one of the Stages from it.

LegoStopMotionSample

Scratch Advanced – Week 15 – Radio Waves

What are we going to learn this week:

  • A tiny little bit about Waves and how clever they are.
  • A pratical demonstration.
  • Thinking – Yes, it’s tough, you will have to do that part 🙂
  • Coding – Sine Waves

I will hopefully demonstrate how differnt types of waves behave.

I will admit, that I am not an expert here and will probably be unable to answer any of your questions, but you see that’s where you come in and start thinking about these things yourself.

A Pratical Demonstration.

What’s in the Box?

I will bring the Box and we can take a look inside, I might even have two boxes, you never know.

Thinking.

Hmmmmm….

Coding.

Remember the Gravity simulation we did, well we can do the same with Waves.

We will build a few Transmitters and a Receiver which can be “tuned” in to the different transmissions. In fact this would be an ideal Application to do using the Networking in Scratch. Does anyone remember that from last year?

Lets see how we get on, we might set this up with one person as the Transmitter and one person as the Receiver.

I have some of the coding done to Transmit a Wave, but will need help in building a transmitter and obviously something to broadcast as well 🙂

Ok, I know Iam supposed to put up the code before the day, but better late than never.

Here is the code for the Transmitter of the radio Waves. Careful with the SIN code has there are a few nested calculations there.

Transmitter

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And here is the code for the Reciever.

Reciever

Intermediate Scratch – Challenge 14 – Build a Network Pong Game!

CDA-S2-Challenge14-NetworkPongThis week’s challenge is to build a 2-player networked Pong game.

This challenge made use of the networking ideas that we covered when writing a network Chat program and previously when we learned about networking.

The big ideas behind this challenge were:

  1. Design of a networked program
  2. Division of labour: there are two programs running on two computers, and we have to decide which is which
  3. Using variables  for exchange of data

Here are the presentation slides from the day, in PDF format: CDA-S2-Challenge14-NetworkPong.pdf

If you would like me to send you these slides in PowerPoint format, feel free to get in touch on Twitter or via the comments!

Beginners/Intermediate Scratch – Challenge 13 – Learn about the Raspberry Pi

CDA-S2-Challenge13-RaspberryPi-Demo

This week in CoderDojo Athenry, the other streams joined us at the start, as we began with a demo of the Raspberry Pi, a really interesting low-cost computer that has been brought out in the last year. It only costs about €30 for a basic one, to which you add a power supply (many mobile phone ones work on it), an SD card (instead of a hard drive), a keyboard and mouse, and connect it to your TV to get started.

We saw it running Scratch and Python programs, and a couple of them were passed around the room for everyone to examine.

We took the opportunity to learn about the main components in a desktop PC: how to identify them and what the function of each one is. We also saw the equivalent components in the Raspberry Pi.

After that, we returned to Mesh networking and the Chatty program that we started a couple of weeks ago, that not everyone had finished.

Here are my notes from the day (PDF format): CDA-S2-Challenge13-RaspberryPi-Demo.pdf

Ninjas who had finished the Chatty program and wanted to do more did work on a 2-player Rock-Paper-Scissors program. We didn’t have notes for this, but I showed the code and it is posted here: http://scratch.mit.edu/projects/cdathenry/3077050  (This is code for one of the players. Similar code is needed for the other one.)

If you would like a copy of my slides in PowerPoint format, get in touch via Twitter or the comments.