# Python Beginners-Week 1

We had a slow start to the Python session due to Wi-Fi and installation issues. However once we got moving we managed to cover variables including strings, math operators and inputs and outputs.
Ninjas are encouraged to read the first three chapters of Invent Your Own Computer Games with Python by Al Sweigart, which is available at http://inventwithpython.com/chapters/ .
Next week we will be looking at loops and decisions in a number guessing game and comparing it to a similar scratch program.

Here are my slides from Week-1
session1slides

# Scratch Beginners – Week 1- First Game “Jaws”

We had a great crowd for our first session today in Scratch beginners. Thank you all for coming and for your patience while we got everyone sorted out with downloading Scratch 2.

We started today with our first game”Jaws”, as well as learning how to write commands to move our sprites, we took a brief look at the interface for Scratch 2.

We also took a first look at some fundamental concepts that we will be using throughout the year. Today we looked at the X and Y axis as well as the number of degrees in a circle.

Here are the presentation slides from the day, in PDF format: CDA-S3-Challenge01-FirstGame-Part1.pdf

I hope you all enjoyed today and hope to see you all again over the next couple of weeks!

# Scratch Advanced – Week 1 – Calculator.

Hi all and welcome back to what we hope will be an exciting year in Coder Dojo Athenry.

We will be using Scratch 2 this year. So the first thing that we need to do is install it.

There are two Applications that you need to install:

2. Scratch2

I will have all the Versions that I can find on USB, which should cover both Windows and Mac. I have installed the Windows version, so I know that one works. I won’t have tested the Mac version though.

Scratch2 introduces the idea of making your own Blocks of code that you can then use in your programs. So for the first week we are going to try these out and see how they can help us write Code once but use it many times.

And for that we need a project to work on – A Calculator.

• We will learn about Functions (Code Blocks in Scratch2)
• We will learn about passing information into Functions

We are going to design and build a fully functioning Calculator that can Add, Subtract, Multiply and Divide. If you get really adventurous you can add some other functions as well – percentages maybe?

Like you I haven’t written it yet, so it going to be a bit scary tomorrow as we have to make it all up as we go along, but hey, you’re the advanced crowd, and should be able to handle that!

Once we have a fully working version I will update this blog with the full details of how and why we did what we did.

If we can get anything like the following picture, I think we are definitely Advanced…

Everything that you see on this calculator is perfectly possible in Scratch2, we will start with the four basic options of Addition, Subtraction, Multiplication and Division.

# 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?

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.

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…