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

Welcome to the 2016-17 Season at CoderDojo Athenry!

coderdojoathenry-infosession-2016-sept

We had a great first day back at CoderDojo Athenry on 17 September 2016, with about 205 young people and their parents attending the first day.

In case you missed the session, you can review the introduction notes here:
1-coderdojoathenry-infosession-2016-sept (PDF)

This year, we have renamed our groups:
  1. Explorers, led by Martha, was formerly the Scratch Beginners group, as well as Scratch, it will include graphics packages and stop-motion animation — overview notes here: 4-explorers-wk1_information-session (PDF)
  2. Advancers, led by Mark and Oliver, was formerly the Scratch Advanced group, and will feature more advanced projects Scratch and packages such as GameMaker — overview notes here: 5-advancers-coderdojoathenry-kickoff-sept2016 (PDF)
  3. Bodgers, led by Declan, was formerly the Raspberry Pi group and will involve hardware and electronics projects — overview notes here: 6-bodgers-coderdojoathenry-info-sept2016 (PDF)
  4. Creators, led by Kieran, was formerly the Unity group and will involve 3D game development in Unity, complemented by 3D modelling and sound effects — overview notes here: 7-creators-coderdojoathenry-kickoff-sept2016 (PDF)
  5. Hackers, led by Michael, is a new group, and is a hacker space for CoderDojo Athenry, with more in-depth projects building on technologies learned in other groups, as well as new ones — overview notes here: 8-hackers-coderdojoathenry-infosessoin-2016 (PDF)

We encourage people to work through the groups in the order listed above. Creators and Hackers are aimed at young people in secondary school.

For the Bodgers group, Declan has also posted additional notes about getting started: Bodgers-Setting up our laptops.

See you all next week!

Bodgers-Setting up our laptops

We returned today after the break with a new name for our group, the Urban Dictionary defines a Bodger as:

1. Anyone who creates objects (machines, vehicles, buildings , etc.) from a mishmash of found or improvised materials.
2. An expert in bodging.
3. An unorthodox hobbyist or artist whose body of work has been cobbled together from garbage or materials used in ways that deviate from their intended purpose.

Every bodger knows that PVC pipe and duct tape are two most important resources on Earth.
You can commonly find bodgers in their natural habitat: hardware stores, dumpsters, and junkyards.

Some of us got a chance to install the software we will need over the next few week but some of us didn’t get a chance to. I have a few slides with instructions for installation here.download-installation-instructions

I’m really looking forward to doing cool stuff with cool Bodgers over the next year.

Congratulations CoderDojo Athenry Members at Coolest Projects 2016!

Congratulations to everybody from CoderDojo Athenry who participated in the CoderDojo Coolest Projects on 18 June 2016.

12 children from CoderDojo Athenry presented their group or individual projects at Coolest Projects in the RDS Dublin – this is the annual competition organised by CoderDojo, and had over 700 projects from Ireland and internationally.

We are very proud of everybody who participated, including 5 of them who won prizes: Shane won top prize in the Hardware category for his Flood Gauge project, Roy won a runner-up prize in the Games category for his Pretendo arcade game project, and Ruaidhri, Luke and Oisin won a runner-up prize in the Games category their Broken Island game written in Unity.

Congratulations to over 100 CoderDojo Athenry ninjas who earned belts on 28 May 2016!

Belts2016

Congratulations to all of our ninjas of CoderDojo Athenry who earned belts on Saturday 28 May and then joined in our party with pizza and chips.

Here are some photos of the day, posted on our Facebook page: https://www.facebook.com/CoderDojoAthenry/posts/1141076832579849

We awarded a total of 102 belts to young people who have mastered a wide range of programming technologies:

  • White belts for being actively involved in the dojo: 10
  • Scratch Beginners: 34 yellow belts
  • Scratch Advanced: 7 yellow and 21 blue belts
  • App Inventor: 3 blue belts
  • Raspberry Pi: 4 blue belts and 1 orange belt
  • Minecraft JavaScript: 7 green belts
  • Unity C#: 1 yellow, 5 green and 9 orange belts

Well done, everyone! We are very proud of you all.

We are very grateful to our supporters –thanks to them and all of the time given for free by our mentors, CoderDojo Athenry is entirely free of cost for all of our participants:

  • Clarin College Athenry and its principal Ciaran Folan, for generously hosting us every week and providing sponsorship towards our belts
  • The Galway-Roscommon Education & Training Board, for an annual youth club grant
  • Medtronic for a Volunteering Grant via mentor Declan Fox, recognising the many hours he puts into CoderDojo Athenry.

And we are very grateful to our special guests from this year: Niall of Colmac Robotics, Chris Tierney with his drone, and Brenda, Donovan and John Romero.

CoderDojo Athenry is now closed for the summer and will resume around mid September. We will notify you all by email when it is restarting.

Have a great Summer!

Michael and the CoderDojo Athenry mentors.

ModderDojo: Exploding Villager or other NPC

I put this together as a simple example of how we can modify the Exploding Chickens mod that was  written in Java by CodeName_B for CoderDojo Athenry and then re-written in JavaScript by Kieran Coughlan:

https://cdathenry.wordpress.com/2015/04/03/scriptcraft-an-exploding-chickens-mod/

My version does not check that the player has damaged a chicken, but instead checks the entity’s name. If the entity is called “Donald” and you hit it, it will explode in 5 seconds! It does not matter whether Donald is a Villager, a pig, or whatever, and you can have multiple NPCs called Donald and it will work on all of them. (In case you didn’t know, an NPC is a non-player character.)

// Require events
require("events");

// Create a var to represent the bukkit type that represents a player
var bkPlayer = org.bukkit.entity.Player;


// The function which we will run when we load this module
var _loadMod = function()
{
 // Announce ourselves to the console
 console.log("Exploding Villager ScriptCraft Mod loading");

 // Tie our code into the event that fires every time one entity damages another
 events.entityDamageByEntity(_entityDamageByEntity);
}

// The code that we want to run each time one entity damages another
var _entityDamageByEntity = function(event)
{
 // Find out, from the event, who's getting damaged and who did the damage
 var damagedEntity = event.getEntity();
 var damagingEntity = event.getDamager();
 
 // If it's a NPC getting damaged by a player, game on...
 if (damagedEntity.getCustomName() === "Donald" && damagingEntity instanceof bkPlayer)
 {
 // Announce in the console that we've detected a player damaging an NPC called Donald
 console.log("Exploding Villager - a player damaged an NPC called Donald");
 
 // Schedule a task to run in five seconds (20 * 5 because the Minecraft clock ticks 20 times a second.
 server.scheduler.scheduleSyncDelayedTask(__plugin, function() 
 {
 // The original Exploding Chckens mod only triggered if its health went to 0 (killed), 
 // but let's comment that out so the first hit causes an explosion
 //if (damagedEntity.getHealth() - event.getDamage() <= 0)
 //{
 // Get the NPC's location
 var loc = damagedEntity.location;

 // Create an explosion at the chicken's location. 
 // A big one...
 loc.world.createExplosion(loc, 10.0);
 //}
 }, 20 * 5); // end of the command to schedule the task
 }
}

// Run this script as soon as the file's loaded

_loadMod();

 

Unity – A Basic Inventory System

backpack-145841_1280

Image from Pixabay

One of our ninjas was looking for a basic inventory system that he could use, so we knocked up something very quickly.

It’s all based on the standard .NET Dictionary class, documented here.

Dictionary allows us to store keys and associated values. In our specific case, our key is a string (the name of the item) and the value is an int (the count of items of that type).

This is all implemented in a script called InventoryManger.cs which is attached to an empty game object, also called InventoryManagement, for convenience. The InventoryManager class provides the following public methods:

void AddItem(string name)

This takes an item name. It looks to see if there’s an item of this name already in the inventory. If there is, it increases the count by one. If not, it adds it with a count of one. This cannot fail, so it doesn’t return anything.

bool RemoveItem(string name)

This takes an item name. It looks to see if there’s an item of this name in the inventory and that its count is greater than zero; it’s possible that it’s listed there, but the count is zero. If there is, it decreases the count by one and returns true. If not, it returns false. The true/false return value allows us to test, when calling this method, if it succeeded, if that’s important to us.

int GetCount(string name)

This takes an item name. It looks to see if there’s an item of this name in the inventory. If so, it returns its count. If not, it returns zero.

So that allows us to add, remove and track an arbitrary number of items with very little effort.

The sample project also has a few other scripts. The intention is that the player picks up objects by moving over them. Pickup objects are tagged “PickUp”. The HandlePickup.cs script is added to the FPSController to detect moving over a pickup. Pickups have a PickupDetails.cs script attached. This automatically tags them “PickUp” and contains the items name (to use in the inventory). The project also has a FruitStealer.cs which removes one banana from your inventory every time you pass through its gate. It’s just there to show the RemoveItem method in action.

Screen Shot 2016-05-15 at 13.33.13

The files for this project can be found here.

Other small things of note about this project: the “bananas” and “apples” are animated, as is the UI-text containing the text “Fruit Stealer”. The material used for the Fruit Stealer is transparent.

 

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