Week 9 Explorers – Scrolling backgrounds

Hi Everyone

We started work on on our scrolling platform game this week and I showed you all how to get started. You can customise even further to suit your game as the weeks go on .

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!

1. We started picking our character from the internet or from the Sprite Library

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 then coded 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

We will add some obstacles this week and maybe have some rewards for our character as well.

See you Saturday

 

Martha

Explorers – Writing Commands to move sprites

Hi everyone,

We had a great crowd for our first session in our Explorers group. A big welcome to all our new Ninja’s and of course a special welcome back to our younger Ninja’s from last year, who are still with us.

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, as well as learning how to write commands to move our sprites, we took a brief look at the interface for Scratch 2.

sprites

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.

axixdegrees

 

 

 

 

 

 

Here are the presentation slides from the day, in PDF format: cda-s6-week_02-firstgame.pdf

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

 

Martha

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

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

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

ModderDojo – Updated Scriptcraft Server

5 Feb 2016: I have compiled the latest version of Spigot (Version 1.8.8, 22 Jan 2016), which is a high-performancse server based on CraftBukkit, and added in the latest version of Scriptcraft (Version 3.1.12, 30 Dec 2015).

You can download it here: https://www.dropbox.com/s/9eg5e5j8j1ubr6w/2016-02-Spigot.zip?dl=0

The version of CanaryMod+Scriptcraft that we were running for the past couple of months was very unreliable, so hopefully this will be better!

Scratch Beginners – Challenge 10 – Maths Game

Wow! We had an exceptional day at Coder Dojo on Saturday! We did a huge amount of work developing a maths game in Beginner’s Scratch. My finished project is on the SCRATCH.MIT.EDU website under the user: CDATHENRY1516. Check it out and upload your final version!CDA-S5-Challenge_10-Maths game-how to

  1. the player picks a level of difficulty and the computer chooses 2 random numbers to add (subtract or multiply- whichever you choose!) together and show the numbers to the player. Fr this we needed 2 SPRITES and 4 VARIABLES called SCORE, LEVEL, NUMBER1 and NUMBER2 as well as 2 BACKDROPS. CDA-S5-Challenge_10-Maths game-ask questions1CDA-S5-Challenge_10-Maths game-ask questions
  2. The player then has to enter an answer to the equation and the computer tells them whether they are wrong or right. CDA-S5-Challenge_10-Maths game-decisions alternative end
  3. We repeated the ask/answer questions 5 or 10 times. Can you figure out where the REPEAT loop fits?
  4. We also had a second sprite who reacted positively to correct answers BROADCAST and negatively to wrong answers BROADCAST. You can use whatever sprites you like and change their look whatever way you like. One coder added a puppy as their second and had him bark whenever an answer was correct. CDA-S5-Challenge_10-Maths game-sprite 2
  5. After all the questions were asked we had the 1st Sprite SAY – Game Over! and BROADCAST Game over so that the backdrop changed and music played. There are two ways to change the backdrop- see below!CDA-S5-Challenge_10-Maths game-alt backdrop CDA-S5-Challenge_10-Maths game-backdropCan you improve our game??! Can you figure out how to subtract or multiply instead of add? Can you get the computer to add three numbers together or give the user 3 level options like: easy, medium or hard? The notes for the Maths Game are here: CDA-S5-Challenge_10-MathsGame-simple addition. Happy Coding! Julie

Beginner’s Scratch Challenge 9 – Storytelling

We had a great day in Scratch Beginners on Saturday! We created a project in which the Sprites all communicated through the use of broadcasts. Each broadcast caused a reaction in the other parts of the program such as the other sprites and even the stage. To begin, we all added two sprites from the library and two backdrops from the backdrop library to the stage. My sprites came with several costumes already supplied, but you can use whatever costumes you like. CDA-S5-Challenge_09-Storytelling-how to

Next, each coder had to decide on a story, conversation or a joke to have one sprite tell the other. After that we placed each character apart on the screen by using the GO TO: command and then had then move together using the GLIDE command. Each part of the conversation is shown on screen with the SAY FOR 2 SECONDS command after which the same words are broadcast to the whole program using the BROADCAST command. The second sprite responds to the first Sprite’s broadcast by SAYing his part of the joke and then broadcasting the same words. This goes back and forth until the story is finished. Keep trying out your scripting by pressing the GREEN FLAG and seeing how it is working. CDA-S5-Challenge_09-Storytelling-1st sprites script

CDA-S5-Challenge_09-Storytelling-2nd sprite script

At the very end, I have the 2nd Sprite send out a final broadcast which causes the backdrop to change and music to play while both Sprites simultaneously do a dance! I just threw that in for fun and to show that BROADCASTS can cause any part of the program to switch on or off. Here is the slide show if it helps a bit more: CDA-S5-Challenge_09-Storytelling. Also, I put my program up on the SCRATCH.MIT.EDU website for you to play with. Search for projects made by cdathenry1516. This project is called –JulieKnockKnockJoke23-01.

Hope to see you all next week when we work on a guessing a number game which requires input from the user to guess the number the computer has picked!

Julie

Happy New Year 2016!

Happy-New-Year-2016c

CoderDojo Athenry will resume on Saturday 16 January 2016 at our usual time and place, 12:00 in Clarin College Athenry (formerly called Gairmscoil Mhuire / The Tech). See you there!

We are very grateful all of our members in CoderDojo Athenry for your involvement and enthusiasm during 2015. And of course we are hugely grateful to our mentors who are so generous with their time and expertise every week, and to the school for accommodating us.

We are looking forward to another year of fun coding and excitement learning about new technologies in 2016, and we hope you are looking forward to it too!

Beginners Scratch – How to make an animated Christmas Scene

Because our last lesson on animation was cancelled, I thought I’d post a lesson online that the kids could access over the Christmas holidays. This Scratch project(Julie’s Christmas Scene) is on the Scratch.MIT.edu website user:cdathenry1516, pw:cdathenry if you want to download it to your computer.

Screenshot (3) I searched the internet for Christmas Cartoon Images and saved a few to my computer:Screenshot (14)

Once I had all the images I wanted for Sprites, I opened SCRATCH and imported the Sprites From File but I noticed that each Sprite had a white background that blocked my nice backdrop. I decided to delete the background from each sprite.christmas scene delete image background

I did this for all my sprites. Next I decided to make the dog wag is tail by

  1. Duplicating the doggie’s costume,
  2. using the select tool to select just his tail and then rotating the tail with the little button at the very top of the selection rectangle.christmas scene make tail wag edit costume

I did the same with Santa’s arm and his shoes. I just rotated them a bit in each costume, back and forth. christmas scene make santa dance edit costume christmas scene make santa wave edit costume

For the lights on one of the christmas trees, I just

  1. duplicated the tree costume 3 times,
  2. poured different colours into the round decorations in each costume.

Lastly, I scripted each of the Sprites like this:christmas scene snow flake script Christmas scene santa script Christmas scene doggie script

That last script is for the doggie! You can script your Sprites in any way you would like. Can you put in a snowman and make him dance about? or bounce around. Can you have presents dropping from the sky like my snowflakes??

Christmas Pizza Party next week!!! Don’t forget to wear a santa hat and decorations! Bring your favourite scratch project and we’ll show the rest of the Dojo!

Julie