Python Beginners – Space Defender

                                       ImageToday in the Python group we looked at how a few simple changes can change the look and feel of a game. Our space Defender game uses code recycled from last weeks Bunnies And Badgers game combined with a few new sprites to make a completely new game. We also looked at how to use Geometry when moving sprites around the screen.

movex=math.cos(angle_z)*10

movey=math.sin(angle_z)*10

xpos+=movex

ypos-=movey

The above code calculates how many pixels the x and y coordinates of our sprite needs to be changed for it to move 10 pixels in the direction of angle_z. You can learn more about Sin and Cos here.

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