Explorers – Guessing Game

Hi everyone,

Good to see you back after the Halloween break.

Last Saturday we did a slightly different game to usual., There was no movement, no sensing when something happened. It was a Maths Game, a guessing game where the computer picks a random number and we had to guess the number.

GuessNumbers

We had to first make sure that a random number was picked using an Operator. Previously we have used a Variable to store a Score or Lives, but this time it was storing the random number and our guesses. Leaving them on screen as we were testing allowed us to understand more about the variable and what it does…it also made the testing a little easier.

Depending how any guesses we were given we repeated our code that number of times. As well as having to make decisions, i.e If_then, we also had to do a comparison before making the decision, to determine whether the guess was correct, too low or too high.

5guesess

Some of you tried to add a timer and below is the code you will need if you didn’t get it to work. Take a look and add it to your own game/games.

timer

 

Here is a link to last weeks notes. cda-s6-week_06-guessnumbers.pdf

 

See you next week!

Martha

 

 

 

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: scratch.mit.edu! Put it on your own login and share it or put it on ours: cdathenry1516.

All the best,

Julie

 

 

 

 

Week 6 – Scratch Beginners – Guessing Game

Hi everyone,

Last Saturday we did a slightly different game to usual., There was no movement, no sensing when something happened. It was a Maths Game, a guessing game where the computer picks a random number and we had to guess the number.

GuessNumbers

We had to first make sure that a random number was picked using an Operator. Previously we have used a Variable to store a Score or Lives, but this time it was storing the random number and our guesses. Leaving them on screen as we were testing allowed us to understand more about the variable and what it does…it also made the testing a little easier.

Depending how any guesses we were given we repeated our code that number of times. As well as having to make decisions, i.e If_then, we also had to do a comparison before making the decision, to determine whether the guess was correct, too low or too high.

5guesess

I hope you all enjoyed the difference this week and we are going try something else different next week. We  (You)  are going to create a Animated Christmas Scene. Get your Thinking Hats On!

Here are this weeks notes in PDF: CDA-S4-Week_06-GuessNumbers.pdf

 

Python Games – Weeks 5-6: Getting started with Pygame

Last week we relocated to NUIG for a Massive Open Dojo Session. There was lots going on to enjoy and it was great to see such a large turn out. Well done to our own Michael Madden and to Karl Sweeney from CoderDojo Galway City for organizing it all. Thanks also to Martha for the t-shirts.

The ninjas from the Python Games group who attended didn’t do any new coding but they enjoyed personalizing the Bunnies And Badgers game with their own images. We were set a challenge to create a game to highlight the environmental issues facing the oceans. We started working on that today and we will continue with that for a few weeks. Ocean Cleaner

Before we started working on that today we had a look at some basic Python concepts contained in this demo program. Next week we will look at using lists and for loops in Pygame and at collision detection.

Here are my slides from today python session_6

Week 6 – Guessing Game

Hello Everyone,

Great to see you all yesterday and welcome to our new members.

Yesterday, we made a slight departure from the games we have done in previous weeks. This weeks game was a mathematical Guessing Game.

DUCK

We only had one sprite and one large block of code. We had to create variables and figure out all the possible situations that could occur when a guess was made.

guess

Again this week, I am looking for you to add your own signature to your game by continuing to add some complexity. Yesterday I saw people add costumes so every time he guessed wrong, a sad face appears. There was also a lot of sound being added! You don’t have to keep all the code either, how about replacing the Repeat 5 times with a 60 seconds timer instead.

I would like you all to keep working on the game and those of you who like me to show your game to the rest of the room, like I did with Alex’s brilliant soccer game, please upload it to the Scratch website. I will show them before the session starts next week.

Next week as I said we will be doing Paint.net, please download in advance if you can. See you all there.

PAINT

Here are the notes in PDF form from our Week 6 Session. CDA-S3-Challenge06GuessNumbers.pdf

ModderDojo Athenry Week 6: Guidelines for Posting Mods

TheCastle

We are now sharing our ScriptCraftJS mods here: https://cdathenry.wordpress.com/2013/11/10/modderdojo-athenry-our-scriptcraftjs-minecraft-mods/

We will keep updating that post as members of the group finish new mods.  Anybody anywhere can download our mods: when they click on the mod’s picture, they will get a link to download it from Dropbox.

Here are some guidelines for posting your mods:

  • Send the mod code and a picture of what it looks like to coderdojoathenry@gmail.com
  • Put a comment at the top with:
    • Your first name (e.g. “Michael from CoderDojo Athenry”) or your Minecraft handle: to look after your privacy online, never post your full name or other identifying information
    • A one-line description of what the mod does
    • If your mod has parameters, what they are for and what values work best
  • Put code near the top to set default parameters, e.g.:
    width = width || 10;
    This means: Set width to be equal to its current value, or if it is currently undefined, set it to 10
  • Check that your code looks fairly neat:
    • Use indentation: good spaces at the start of each line to line up the code
    • Include comments to explain things
    • Avoid commented-out code or code that does nothing
  • Test your code carefully and inspect its results to make sure it works as expected!

 

Python Beginners- Week 6: Lists

Today the Python group began looking at the Hangman Game from Invent Your Own Computer Games with Python (http://inventwithpython.com/chapter9.html). There are many new concepts in this game so we are going to spend the next few weeks looking at these.

We looked at Lists which are a way of storing a number of values in one variable. We had some fun writing code snippets mainly based around X-Factor. They are available here https://www.dropbox.com/sh/ax43g3recnn02p6/Cat_QexogU

We looked at some new ways of working with strings such as multi-line strings.  We also learned about new types of functions called methods.

Next week we will be looking at a new type of loop called a for loop.

Here are my slides from today. python session6

Beginners Scratch – Challenge 6 – Story-Telling and Scrolling Backgrounds!

This week, our challenge is to work on Animation projects. We are looking at two project ideas: telling stories and scrolling backgrounds.

To tell a story, we have two sprites with speech and pauses carefully timed so that they have a conversation with each other. I just did a simple knock-knock joke, but you could do more.

After, we worked on how to make a scrolling background, a bit like the scrolling demo example that is supplied with Scratch. We figured out how to create the appearance of left/right movement by moving a sprite representing the ground in the opposite direction. We also found out how to make distant background objects, like mountains, move more slowly (called the parallax effect).

Coding concepts that we discussed included:

  1. Speech bubbles and sound
  2. Timing sprites
  3. Loops

Here are the notes from the day (PDF): CDA-S2-Challenge06-StoriesAndScrolling.pdf

Here is my Knock-Knock animation: http://scratch.mit.edu/projects/cdathenry/2899125

And here is my Scrolling Background with Mario: http://scratch.mit.edu/projects/cdathenry/2531497

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

Advanced Scratch – Week 6 – Lets Build a Piano

 

What are we going to learn this week, well it might take two weeks to get this completed.

Lists – How to put stuff in.

Lists – How to get stuff out.

Record – How to record things that happen, we might use a list for this 🙂

Playback – How to replay things that have happened, we might use a list for this 🙂

Mouse – where is it on the Screen, we use this to determine which Piano key has been pressed.

Lists

So what is a List, well they are like variables, you get to them from the same screen, but there are just a lot of them joined together. You would normally use them for similar types of things, like a Shopping list for example, where you put different items of food:

Chocolate, Crisps, Biscuits, Tea, Coffee.

We are going to use a list to store all the different Piano Keys that have been clicked. We can then use the same list to Play the Notes back again.

We also get to use the Button Building Block to add some buttons, one for Record and one for Play etc.

So what do we need for out Piano, well, we need a keyboard for a Start, we only need 16 notes (2 octaves) and we can either draw it ourselves or borrow one from somewhere.

Something like this would be good

Then we need to play the right note depending upon where the user has clicked.

There is one piece of easy code that just needs to be repeated over and over again with slightly different numbers. Here is a sample of what is needed and then you just need to repeat it with the different numbers for the location (mouse X / Y position) of the different keys.

 

 

 

Playback Time – so how do we play back what we recorded, well I just imported my Go Button Sprite to start the Playback and added the following code to run when I recieve the Broadcast from the Go Button… Remember how we did this before.

I needed to create another variable as well to keep track of which Note in the List we should be playing.

And finally, there is some initialisation code that keeps things nice and tidy when you click the Green Flag. But you could import another Button and use that to reset the Notes List, which would be much nicer. And don’t forget we already have the Button as a Sprite, so this should be easy to add in.

The go to x,y code I found to be quite useful as when you Click on the Piano Keys it can move the Keyboard around a little. But again, remember this will only happen in “Design” mode, when you switch to Presentation Mode, you won’t see this problem.