Beginners Scratch – Challenge 2 – Guess Numbers

Today’s challenge: write a number guessing game!

In doing this, these are the big ideas you will learn about:

  1. Input and output: entering numbers and displaying them
  2. Using variables
  3. Comparing values and making decisions

Here are my notes from the day, in PDF format: CDA-S2-Challenge02-GuessNumbers.pdf.

If you would like me to send you the PowerPoint slides of my notes, get in touch via twitter or by leaving a comment.

Advanced Scratch – Week 2 – Buttons and Crazy Images.

What are we going to learn this week…

  • How to imitate a Button
  • How to use the Pen controls
  • How to use sliders

Buttons.

 Wouldn’t it be great if you could have buttons in Scratch, that you can click and make things happen?

Well you can, there might not be a code block to do it, but we can make one.

 You will need a Sprite with Two Costumes

  • One for the Up position
  • One for the Down Position

 

See how I have given the Sprite a meaningful name and also each costume has a name. The only difference between the sprites is the bottom one has no shadow and is slightly lower and left (covering the shadow).

Cool Tip: You can export the Button Sprite which will save it with all the code as well. This means it is easy to add Buttons to any other Scratch Projects. 

Crazy Images.

We are going to use the Pen Tool to draw some fancy Spirograph like images.

First we need a Sprite that will do the drawing, I just created an invisible Sprite, so you only see the Line being drawn.

Spirographs work using circles, but we are going to use triangles, squares, pentagons, hexagons and heptagons (7 sided).

If you walk 10 steps turn 90 degrees and walk another 10 steps and again and again, you have wlaked in a square, but if you change either how many steps or the angle you turn by a very SMALL amount and just keep[ going you can generate some very interesting patterns.

Sliders.

We will also be using sliders to control the nember of sides to the shape and the change in angles.

Sliders are variables that are displayed on the screen with a slider control to change the value as the program is running. To get the variable to show as a Slider just dbl click on it, once, changes it to a Slider, dbl clicking again, removes the name.

If you right click on the SLider you can set Min and Max values.

The code to create the Spirals is split into two parts. One runs when youclick the Green Flag, this just sets everything up ready.

 

The next piece of code is what does all the work, notice where the Slider variables are used and how the code makes more sense when you give variables descriptive names.

Beginners Scratch – Challenge 1 – First Game

Today’s challenge: write your first computer game!

In doing this, these are the big ideas you will learn about:

  1. What is coding?
  2. Who writes code?
  3. What is Scratch?
  4. How do you write code in Scratch?
  5. What are the steps to write a program?

Here are my notes from the day, in PDF format: CDA-S2-Challenge01-FirstGame.pdf

If you would like me to send you the PowerPoint slides of my notes, get in touch via twitter or by leaving a comment.

Advanced Scratch – Week 1 – The Movies

Movies are lots of single pictures shown very quickly one after the other.

Most movies run at 24 pictures a second!!

We can do the same in Scratch.

 

Question: If there are 24 pictures in one second, how long is each picture shown for?

Answer: in 100th of a second please…

You should have come up with something like this…

1 / 24 = 0.042

And we can code this in scratch like this:

 

 

And to keep things nice and neat, we can use a Broadcast to tell the Sprite to move

Now you don’t need to change this code anymore…

So what kind of Sprite  are we going to have and how will it move?

Well for this demonstration we are going to use a Wheel, it can be of any style, but one with spokes works best to demonstrate the Wagon Wheel effect.

Wheels, are circular 🙂 and circles have 360 degrees, if a wheel turns a full 360 degrees between each frame, then it will appear to stand still.

Some more Maths! Depending upon the number of Spokes in your wheel you can get different effects.

Lets start with one Spoke!

And to make things interesting we will create avariable so we can turn it by different degrees quite easily.

So we set it up to recieve the broadcast from the Movie Machine and turn round by a certain amount each time.

In the example above I have used the variable, but you don’t have to you can just put in a number.

Try the following numbers and see what effect you get:

90 – what do you see?

180 – what do you see?

360 – what do you see?

And if you want to get real fancy and use a variable, you can add the variable, and the following code to adjust whilst the program is running.

What next?

Try numbers very close to the ones above…

Try a wheel with different numbers of spokes and different numbers…

Remember the games we did last year? You could add a spinning ball…

 

CoderDojo Athenry: Introduction to our Second Season!

Three Streams

CoderDojo Athenry is restarting on Saturday 22 Sept 2012, and every Saturday after that, 12-2pm in Gairmscoil Mhuire VEC School, Athenry.

We held a well-attended information and registration session on Sat 15 Sept. You can click on this link to see all of the notes, in PDF format: CoderDojoAthenry-InfoSession-2012-09-15.pdf.

Our big development this time round is that we are going to run 3 separate streams:

  1. Scratch Beginners: ideal for ninjas who are starting out, or would like to recap
  2. Scratch Advanced: ideal for younger ninjas who started with us back in March and have their yellow belts
  3. Python Beginners: aimed at older ninjas, particularly teenagers

All streams will be in the same room at the same time, which may make things chaotic but will maximise opportunities for collaboration, interaction, and flexibility for people to try one stream and switch to another.

Python is a general-purpose, high-level programming language, that is used in a wide range of programming applications. Unlike Scratch, the program code is are text-based, though it can be used to build graphical applications.

To receive email updates and notes from the weekly sessions, please make sure you are on the CoderDojo Athenry Google Group.

Some other points:

  • This is completely free! Nobody pays and nobody gets paid.
  • You can register by coming along any time and filling out a registration form.
  • All ages are welcome! Even parents accompanying U13s are welcome to join in programming if they wish (though you don’t have to).
  • More mentors are always needed, female as well as male.
  • Each week, bring a laptop (with wifi), your laptop charger, and some food if you wish.
  • Under 13s must be accompanied.
  • We will award more belts before Christmas – we will provide details in a few weeks.

Above all, be cool!

Michael.