Week 7 – 2015 Scratch Beginners – Scrolling Backgrounds

Hi everyone,

Thank you all for coming Saturday on such a nice day and such a busy day of sport as well!
We started our Mario game, where we will use scrolling of objects in the background to achieve movement rather than making Mario move.
scrolling

It can be a difficult concept to grasp for the younger ones, but we will go through it again next week before we continue on with the game.

scrolling2

Rather than putting up the notes from this week, I will wait until we have the game finished before putting up the completed notes.
I have however, put the game (as far as we did today) on the Scratch Website http://www.scratch.mit.edu. Login with the User name coderdojodathenry and password xxxxxxx123 and you will be able to download the game if you weren’t here this week or have a look at the code to get your own game work working.

MarioGamehttps://wordpress.com/post/40558549/912

See you all next week, when we will make Shrink and add some more scrolling sprites!

Martha

Website Development 2 – Links, Paragraphs, Headings and Images!

Hi everybody!

This weeks notes are all about putting headings, paragraphs, links and images on our webpages! Have a look at the notes and play around with the new tags that you can learn from them. If you have any questions just send me an email! My email address is on the last slide of this weeks notes. I am going to be at Gairmscol Mhuire during Coderdojo on Saturdays so you can ask me questions there too!

Here is a link to this weeks notes!

Happy Coding,

James

Web Development 1 – Getting started with HTML

Hi all, the Web Development stream starts this week. It will run alongside the other streams so you can still learn Scratch, Python or Minecraft Modding on Saturdays and spend a small amount of time learning HTML during the week. HTML is fun and the thing we need most is ideas about how webpages should look or ideas about what to put on them! We can then work together to translate these ideas in to webpages! If you are interested have a look at my presentation on getting started with HTML!

Here is this link to the presentation. 

ModderDojo Java Modding 6: Creating Our First Mod – Adding A Crafting Recipe

Previous post: ModderDojo Java Modding 5: Creating Our First Mod – The Basic Code

Note: the instructions at this link are good but things have changed a bit for Forge 1.7: http://www.minecraftforge.net/wiki/Crafting_and_Smelting

Different types of mods require different types of code. One of the easiest type of mod to add is a crafting recipe. We will write one to turn some dirt into diamonds.

craftdiamonds

The code for this goes into the init function:

recipecode

What this does:

  • Create a new ItemStack called dirtStack with a single dirt block
  • Create a new ItemStack called diamonds10 with 10 diamond blocks
  • Add a new recipe to the game that will produce this stack of 10 diamonds, when you lay out the dirt in the shape specified: x in the shape is where the dirt blocks have to go.

We can also have shapeless recipes (where it doesn’t matter where you put blocks), which are even simpler to write:

GameRegistry.addShapelessRecipe(
new ItemStack(Items.diamond, 6), new ItemStack(Blocks.dirt));

This second one creates a stack of 6 diamonds from a single block of dirt.

Previous post: ModderDojo Java Modding 5: Creating Our First Mod – The Basic Code
This concludes this series of posts on getting started with Java Modding, from ModderDojo Athenry.

 

Week 1, 2014 Scratch Beginners – Storytelling

Happy new year

We had a great turnout today for our first session of 2014. A very special welcome to our 14 new ninjas who joined us for their first coding session today. I hope you enjoyed your first visit to Coderdojo Athenry.

To ease everyone back in (including myself) we took a look at doing some storytelling. This involved again learning about the X, Y position of the stage, some movement of the sprites using the Glide command and of course testing our code to ensure that our timings were correct.

xy

We look forward to seeing you all next week, when we will be using scrolling backgrounds.

The PDF version of todays session are available to download here: CDA-S3-Challenge08-Storiestelling.pdf

Martha

ModderDojo Java Modding 5: Creating Our First Mod – The Basic Code

Previous post: ModderDojo Java Modding 4: Creating Our First Mod – Getting Started
Next post: ModderDojo Java Modding 6: Creating Our First Mod – Adding A Crafting Recipe

There is an example mod that does nothing in src/main/java, in the package com.example.examplemod. We will make a new one based on this.

Start by making a new package in the same folder, where we will put our own code. Click on src/main/java, then from the menu select File – New – Package, and pick a package name:

forgepackage

Now create a class in it: File – New – Class and give it a name. There is no need to select the “public static void main” option; we will be replacing all the code.

forgeclass

From in ExampleMod.java, copy all of the code, then delete all of the code in your own class and paste in the code from ExampleMod. Now make some changes:

  • On the top line, change the package statement: it has to correspond to the package you created your class in. Eclipse will flag the error with a red line and its quick fix will allow you to change the package.
  • On the line public class ExampleMod, change ExampleMod to the name of your class. In Java, the file name and class name have to be identical.
  • Check that the @Mod statement refers to your class, not ExampleMod. Note: statements beginning with @ in Java are called annotations.
  • In the body of your class, change the values of the variables MODID and VERSION.
  • If you like, change the System.out.println line to print a new message to the console window, e.g. “Craft1 mod initialised.” Lots of messages are displayed in the console window when Minecraft runs; you should see your message near the end.

Now run Minecraft and see if your mod exists. The name should be there and your hello message on the console, but it doesn’t do anything because we haven’t added code for anything useful.

Previous post: ModderDojo Java Modding 4: Creating Our First Mod – Getting Started
Next post: ModderDojo Java Modding 6: Creating Our First Mod – Adding A Crafting Recipe

ModderDojo Java Modding 4: Creating Our First Mod – Getting Started

Previous post: ModderDojo Java Modding 3: Getting Started With Eclipse
Next post: ModderDojo Java Modding 5: Creating Our First Mod – The Basic Code

Start up Eclipse and select the workspace that Forge created, in the Eclipse folder under Forge:

forgeworkspace

Note: if the workspace is empty, make sure that you ran the command gradlew eclipse and that you selected the correct folder.

Press the green Run icon: you should see messages in the Eclipse console window and Minecraft will launch and will initially have 4 mods.

Previous post: ModderDojo Java Modding 3: Getting Started With Eclipse
Next post: ModderDojo Java Modding 5: Creating Our First Mod – The Basic Code

ModderDojo Java Modding 3: Getting Started With Eclipse

Previous post: ModderDojo Java Modding 2: Setting Up Your Development Environment
Next post: ModderDojo Java Modding 4: Creating Our First Mod – Getting Started

While waiting for Forge to install, let’s try out Eclipse.

If this is your first time running it, you will be prompted to create a workspace: the default location is fine

The first time, a Welcome screen appears, which you can X to close.

Java code belongs in classes, classes are organised in projects, and projects are in a workspace. In Eclipse, you can only have one workspace open at a time, but it can have multiple projects in it and each one can have multiple classes.

Create a new Java project: File – New – Project… then expand Java and select Java Project

newproj

Enter a project name, e.g. Test:

newproj2

If you are asked to switch to the Java Perspective, say yes.

To create a first program class file, select File – New – Class

Give the class a name (no spaces allowed), and tick the box at “public static void main”, as this will create some initial code for you:

newclass

You now have a starting piece of code:

test1java

Under the “TODO” comment (which you can delete or replace with a comment of your own), write a line of code to put up a message box:
JOptionPane.showMessageDialog(null, “Hello world”);

A red line will appear at JOptionPane, as it is not recognised; hover over it and select the fix “import JOptionPane”, which will add an extra line at the  top.

Alternatively (or as well), you could print a line to the system output, which goes the console window – that’s the one at the bottom of the screen in Eclipse:
System.out.println(“Hi there”);

testjava2

Press the Save icon and then the green Run icon to run your first program:

hellodlg

Previous post: ModderDojo Java Modding 2: Setting Up Your Development Environment
Next post: ModderDojo Java Modding 4: Creating Our First Mod – Getting Started