Beginner’s scratch – Creating your own projects!

It is belt awarding time at Athenry Coder Dojo! We are really excited to see what everyone is going to come up with this year. In previous years, we have had great projects that use many of the core principles of programming that we have been teaching since the beginning of the year. Here is a list:

  1. MOTION – controlling the movement of a SPRITE by the keyboard, the mouse or randomly by the computer,
  2. LOOPS – using forever or limited repeat blocks to keep something going,
  3. VARIABLES – saving a value in computer memory where the computer can pick it up and use it or change it when necessary,
  4. DECISION blocks – Using IF or IF/THEN blocks to decide if something should happen or not,
  5. BROADCASTS – sending out a message to trigger a reaction in another part of the program,
  6. ANIMATION – using costume edits and changes within loops to make it seem as though a sprite is moving.

You don’t need to use all of the above principles in your project, but we mentors need to know that you understand them in order to let you move up to the next level – Advanced Scratch. While we are helping you with your projects, we will be reinforcing the principles, so it will be fun and easy! The day of the awarding of belts, we will ask you questions on your project while you are demonstrating it.

You must be present on belt award day  to show us your projects. If you don’t get the belt you want, don’t worry! There is always the next belt award session and we love having you at Coder Dojo Athenry.

Here are some of the questions we might ask at the belt awards session:

1.Which block you would use to make the sprite speak?

2.How would you change the way your sprite looks?

3.How would you make a sprite move?

4.Can you show where you have used a loop block?

5.Can you show where you have used animation or sound?

6.Can you show us where you have used an IF block?

7.What blocks would you use to check if your sprite hit something?

8.How do you share a program online?

9.Show where you have used a variable or how would you create a new variable?

10.Show where you have used a broadcast or how would you create a new broadcast?

Here are some ideas for projects:

Squash Game

Control a bat to hit a ball

Ball bounces off wall on the other side

Game over when you miss 5 times

ABC Game – letters falling from the sky!

Sprites with A/B/C fall from random start point

Press A/B/C key to stop them

Keep score of how many you stop

DodgeBall –

Have Scratch cat avoid the flying beachballs while he is trying to grab a mouse

Use the arrow keys to control scratch cat and have three or four beachballs fly around randomly

If the cat gets touched by a ball make him lose strength/fade but he gets stronger if he touches a fish.

Use a broadcast to change the backdrop wen he gets his score to ten or to zero.

Good luck and be sure to ask questions! We love to help!

Julie

Scratch Beginners – Challenge 14 – Create a Piano

This week and part of last week we created a piano! The initial keyboard looked like this:
cda_s5_challenge_14_piano_keys

Each white and black key is a separate SPRITE. We began by drawing the white Middle C SPRITE which has two costumes. The first costume is white and the 2nd is a different colour (you choose) that flashes up when the SPRITE is CLICKED. This helps us to see which sprite is responding to the click.

Continue reading

Brenda and John Romero, renowned game developers, speaking at CoderDojo Athenry on Saturday 9 April 2016

romeros

We are very excited to announce that Brenda and John Romero, who between them have been involved in developing exceptional games such as Doom, Quake, Tom Clancy’s Ghost Recon, and Dungeons & Dragons, will be at CoderDojo Athenry on Saturday 9 April 2016. They will be speaking to us about their extensive experience as leading game developers. They will be joined by their 11-year old son Donovan, who has also started developing games.

Brenda and John have recently moved to Galway from the West Coast USA, and are currently in the process of establishing a game studio, called Romero Games, in Galway. Their brief biographies are below.

Regular attendees at CoderDojo Athenry are welcome to bring a friend if they wish. These talks should be really fascinating for our budding coders and game designers in CoderDojo Athenry, and inspirational for boys and girls alike!

PS: Huge credit to Kieran (lead mentor of the Unity stream) for organising this!

 

Brenda Romero 

Brenda is a game designer, artist, academic, and Fulbright Fellow. She has been in the games industry since the early 1980s. Her credits include such notable games series as Tom Clancy’s Ghost Recon, Wizardary and Dungeons & Dragons.  She’s previously sat on board of the International Game Developers Association (IGDA) and chaired several Special Interest Groups (SIGs) including one representing Women in Games. 

John Romero

John is best known as the founder of Id software. An exceptional programmer and game designer, he is the inventor of the “deathmatch”. His best known games include such timeless classics as Commander Keen, Wolfenstein 3D, Doom and Quake each of which broke new ground, both in technical and gameplay terms and even spawned new genres.

Additional 

John and Brenda are currently in the process of establishing a game studio, called Romero Games, in Galway. Their son Donovan, also visiting us, is writing a game with the help of his Dad and friends and will hopefully be demonstrating it on the day.

 

ModderDojo 2016: Adding a Crafting Recipe in Scriptcraft

craftdiamonds

In a post from last year, we saw how to create crafting recipes in Java modding:

https://cdathenry.wordpress.com/2014/01/19/modderdojo-java-modding-6-creating-our-first-mod-adding-a-crafting-recipe/

It is also possible to do the same thing in Scriptcraft. Here is the code for a dirt to diamonds recipe in Scriptcraft:

Note: write the code in a file called something like “recipe1.js” and put it in the same folder as your other Scriptcraft mod (a sub-folder of scriptcraft – plugins). Note that this is the entire code – it does NOT go inside a function definition.

[code language="javascript"]
// Scriptcraft recipe for dirt to diamonds
var recipes = require('recipes');
var items = require('items'); 

// Here is the recipe: result from ingredients in a shape.
var dirt2diamond = {result: items.diamondBlock(10),
                    ingredients: {D: items.dirt(1)},
                    shape: [ ' D ',
                             'D D',
                             ' D ' ]};

// add the recipe to  the server
recipes.add(dirt2diamond);
[/code]

The code is reasonably easy to understand, I think. The result is a stack of 10 diamondBlock items, there is a single ingredient which is a dirt block that we indicate with a variable ‘D’, and they are arranged in a diamond shape. I have put in extra line breaks to make the shape clearer, but this is not necessary.

You can have more than one ingredient. Here is another example:

[code language="javascript"]
// A second recipe:
// diamond block made with a diagonal line of 2 dirt , 1 cobblestone, and 2 dirt
var recipe2 = {result: items.diamondBlock(1),
               ingredients: {D: items.dirt(2), C: items.cobblestone(1)},
               shape: [ 'D  ', ' C ', '  D' ]};
// add the recipe to  the server
recipes.add(recipe2);
[/code]

Beginner’s Scratch Challenge13 Easter Egg Painting Fun

This week I decided to make a game that gives the user choices. In order to decorate the egg, we give the user a few choices of colours and stickers to put on the Easter Egg and the user must click on the colour and sticker they like. We had to import sprite images from the internet, draw some of our own sprites from scratch and get sprites from the library. In the beginning after the green flag is clicked, I used the SAY block to give instructions that disappeared after 10 seconds.cda-s5-challenge_13-decorate_an_egg-stage_with_say

We found an EGG, CHICK and BUNNY cartoon image on the internet and saved them to an image file on our desktop. I clicked the Add Sprite From File and found these images on my desktop and added them as new SPRITES. I then cleaned up the background of these sprites and made it transparent.

I drew a Spot SPRITE that I moved over on top of my egg to make it look good and I drew a Stripe SPRITE that roughly fell on top of the egg. You can move, shrink and grow each of these sprites so that they look OK on the egg. Now we have to get the BUTTON SPRITES on the side and the PAINT BALL SPRITES on the bottom. I started with one button that I found in the library and imported it. I changed it’s colour and wrote the word SPOTS on it in it’s costume editor using the T button. Here are what my sprites looked like:cda-s5-challenge_13-decorate_an_egg-sprites

The basic idea is that the BUTTON SPRITES (on the side) and the PAINT SPRITES (on the bottom) send a BROADCAST when CLICKED.Here is the script for the SPOTS BUTTON. That’s all there is. 
cda-s5-challenge_13-decorate_an_egg-SPOTS_button

And the STICKER SPRITES (the chick, bunny, spots and stripes) respond to each BUTTON broadcast by SHOWing or HIDEing. As each sticker called that one SHOWS and the others all HIDE. Here, this is the script for the SPOTS SPRITE. See how there is only one SHOW block under the WHEN I RECEIVE SPOTS sprite. This SPOTS SPRITE will only SHOW when the SPOTS BUTTON is clicked and sends out the broadcast SPOTS. When any other sticker button is pressed, it will hide.cda-s5-challenge_13-decorate_an_egg-dots_script

The CHICK SPRITE will look exactly like this, except that the SHOW block will be under the WHEN I RECEIVE CHICK block! The PAINT BALL SPRITES do the exact same thing. They send out a broadcast, when clicked, that tells what colour the user picked. The SAY block helps let people know what to do.cda-s5-challenge_13-decorate_an_egg-orange_paint_ball

The EGG must now react to the broadcast. We need to add a new the EGG SPRITE costume that matches the colour of the paint ball and rename the costume to orange. After I added the new costume, I put the WHEN I RECEIVE orange, CHANGE COSTUME TO ORANGE. The same happens for each other coloured PAINT BALL SPRITE.cda-s5-challenge_13-decorate_an_egg-egg_scriptAs you add buttons for other decorations on the egg, create or import the decoration and then script them as we have done above for the SPOTS. My final project is on the SCRATCH.MIT.EDU website. Search for projects for the username:cdathenry1516. I will share it so you can play, change the scripts or downlod it to your own computer. Have fun!

Julie

Information About Coolest Projects 2016

AboutCoolestProjects.jpg

At the start of the session on Saturday 27 Feb, we had an information session about the CoderDojo Coolest Projects contest.

I think it is well worthwhile to consider entering. There are multiple categories and the event is very impressive and interesting.

Special thanks to Aliadh who spoke very well about her experience at Coolest Projects last year.

The notes are here: AboutCoolestProjects.pdf

ModderDojo 2016: Planning a Large Collaborative Mod

DSC_0132

On Saturday, following on from the general information session about Coolest Projects, we started planning a large collaborative mod in the JavaScript/Scriptcraft ModderDojo stream.

We used my favourite planning and design tool – a big whiteboard and a couple of markers.

As the image above shows, we first identified what kinds of things we are already able to make, and we used these as a startpoint for brainstorming some ideas that could build on our capabilities. Finally, we reviewed some of our brainstormed ideas to identify some common threads and in particular some kinds of capabilities we don’t have – things that we will have to learn how to do in future weeks.

For example, we now know that we need to learn about event-driven programming, creating recipes, creating NPCs, creating new block types, and maybe generating biomes. Alex and I will help you to figure out some of these ideas in future weeks.

Since attendance was low, we did not finish the planning and make a final decision about what the theme of our mod is, since we would like more people’s input. But we have made a great start!

Reminder: on Saturday 5 March, there will be no ModderDojo stream as both Alex and I happen to be travelling.

 

Beginner’s Scratch Challenge 12 – Scrolling backgrounds

This week we are exploring a new concept of moving across a landscape like some of the treasure hunting type games such as Super Mario Brothers(SMB). Mario moves through a landscape of dangers and treasures looking for Princess Peach. He must avoid turtles and capture coins in order to keep going and not lose lives and start all over! Here are the notes in PDF:CDA-S5-Challenge_12-Scrolling backgrounds.cda-s5-challenge-12-scrolling-intro

To understand the concept, you must understand that the STAGE is only 480 pixels wide (x goes from -240 to +240). No one SPRITE can be larger than the STAGE and we won’t be able to see a SPRITE that isn’t on the STAGE (ie. it’s x position is less than -240 or greater than +240). So we have to set up a series of SPRITES that extend past the stage and move them across the stage from left to right and under Mario’s feet to make it look like he is moving over the ground from right to left! Get it? It’s tough, but by the end of next week we will have a cool game!cda-s5-challenge-12-scrolling-stage_size


1. We started by downloading an SMB cartoon character from the internet and saving it as an image file (either .png or .jpg) on our desktop or in our personal folder. We used this file to import a new sprite from FILE from the NEW SPRITE area. We then had to make any white background transparent and shrink Mario down to a reasonable size.

2. Next, we drew our own Ground SPRITE using the PAINT NEW SPRITE button. Important!! The sprite must be the full length of the stage!! See the 1st picture above for an example of what the ground sprite could look like. Mine looked like a brick wall, but yours can look like a stone wall or concrete one or some kind of footpath or road.

3. Now we must code our Ground SPRITE! We need to set it’s inital x position to zero and continuously move it in a direction for as long as we are pushing the right or left arrow buttons. To do this we need a new VARIABLE called XPOS. Go to DATA and create this new VARIABLE. See the image below on the bottom the instructions for setting up the initial position of the first ground SPRITE. After you create and code the first one, we can duplicate Ground SPRITE 1 and create Ground SPRITE 2. Be sure that Ground SPRITE 2 has an xpos set to 480 pixels more than Ground SPRITE 1.  cda-s5-challenge-12-scrolling-ground_sprites_1

4. Lastly, for this week, we need to get the Ground SPRITES to move!!

!!IMPORTANT! !Click the little i button on your Ground  SPRITE and see all the information about the SPRITE. Change the rotational direction of the Ground SPRITE to non-rotational. It is a button that looks like a dot.

We will code the Ground SPRITES to move to the left when we press the left arrow key and to the right when we press the right arrow key on our keyboards.  See below: Be careful to program the left arrow key to Point In Direction 90 and the right arrow key to Point In Direction -90. Notice both the Change xpos By commands have different numbers! (-5 and +5) Get these wrong and the SPRITE will not move in the correct direction. Once you have the 1st ground SPRITE working the way you like, duplicate it and all it’s coding. All you have to change in Ground SPRITE 2 is the xpos. It must be set to XPOS +480. If you duplicate that sprite, you must set it’s xpos to XPOS + 960 and so on and so on…cda-s5-challenge-12-scrolling-ground_sprites_2

My original project is on the Scratch.MIT.edu website. You can log on with your own login name or use our one – CDATHENRY1516 and our password is CDATHENRY and play the game or download it to your computer for next week’s class. Next week will will be coding Mario to jump and to always return to the ground and giving our program a bit of perspective with a mountain in the background. I’ll try adding a coin or two for Mario to jump up and grab! See ye all next week!

Julie

Beginners Scratch – Guessing Game

This week we decided to give everyone a little breather after the marathon that was last week!! The Guessing Game covers a lot of the same ideas as the Maths Game and reinforces the use of decisions and variables.

For this game we need: 1 sprite (to tell the player what to do and if their guess is correct or not), 2 backdrops and 2 variables (THE NUMBER and GUESS). The SPRITE holds most of our scripting.

FIRST: Scripting in the SPRITE, pick a random number and store it in the variable: THE NUMBER. Tell the player (use SAY block) that you are thinking of a number between 1 and 30….

CDA-S5-Challenge_11-Guessing Game-set random number

SECOND: ASK (yes, use the ASK block!) what the player’s GUESS is and store their guess in the Variable GUESS. !!!!NOTE: when you use the ASK command, the user input (their guess) is always stored in the variable ANSWER, until you reassign it to your own variable GUESS with the SET command in DATA)!!!

CDA-S5-Challenge_11-Guessing Game-ask for guess

THIRD: TEST whether the GUESS is TOO HIGH, TOO LOW or CORRECT using the IF decision block and OPERATORS: >(greater than), <(less than) or =(equal to).Also, TELL the player (use the SAY command) if they are TOO HIGH, TOO LOW or CORRECT.

CDA-S5-Challenge_11-Guessing Game-test guess

FOURTH: LOOP IT!! Use a REPEAT 5 times to give your player 5 chances to get the guess right. Check your work!! Go through each of the possibilities one time to be sure you get the correct response. What if they get it WRONG 5 times?? Tell them what the number was!

CDA-S5-Challenge_11-final script with loop

Use your own imagination to add new sprites that react to a broadcast you could send out after they guess the right answer or wrong answer. Get your backdrop to change after they guess correctly. (Hint: BROADCAST correct before STOP ALL and have the backdrop SWITCH costume when it RECEIVES the BROADCAST)CDA-S5-Challenge_11-Guessing Game-more to do

My copy of this game is up on http://scratch.mit.edu. Search for the cdathenry1516 coder name and check it out! Here is a copy of the notes: CDA-S5-Challenge_11-GuessNumbers.

We are taking a break for the next few weeks for mid-winter break! We will be back on February 27th! Happy Coding!

Julie