Hi Folks,
We continued with Learn GDScript from Zero, completing lessons 10-17. We’ll continue with this next week.
If you want to practice or catch-up, the link is here: https://gdquest.github.io/learn-gdscript/

Hi Folks,
We continued with Learn GDScript from Zero, completing lessons 10-17. We’ll continue with this next week.
If you want to practice or catch-up, the link is here: https://gdquest.github.io/learn-gdscript/


Hello Bodgers
It was great to be back and to get started for another year. We spent most of last Saturday getting set up for the year ahead. We began by installing our Python Editor Mu, you can download it here.
We also installed Paint.Net which we will use for editing images for our sprites, you can get Paint.Net here.
I have created some resources for our games that are available on Dropbox here, download the folder called CoderDojo and save it to your Desktop.
Launch Mu and load the file called day_1.py from the CoderDojo folder you just downloaded and enter the code from the worksheet below..
Click Play and your first Python game should run.
Looking forward to seeing you all again next Saturday.
Declan, Rob and Kevin
Hi folks,
This week we’ll start off by working on learning Godot’s GDScript language using this online resource:
https://gdquest.github.io/learn-gdscript/

Hi folks, the full 2024-2025 schedule is now available on our website.
If you haven’t been to CoderDojo Athenry before, you’d like to know more information on the sessions we’re offering this year, or you have some questions, please come along to our Information Session on Saturday next (28th Sept 2024).
If you’ve attended CoderDojo Athenry before and already know the group you’re interested in, we’d be delighted to see you on the following week at our first normal session (5th Oct 2024).

We are back!
There will be an information session on Saturday 28th September 2024 at 12pm in Clarin College, Athenry.
Anyone who has children attending CoderDojo for the first time, or just has questions they’d like answered is encouraged to come along.
The session is expected to last less than one hour.
A full schedule for the 2024-2025 season will be posted to our website within the next week or two.
Looking forward to seeing you all there!
Hi folks, here are some photos from our end-of-year party today and a photo of some ninjas, some mentors and some Tesco members of staff at Tesco Athenry marking the end of our Community Fund collection period. Thanks to Tesco Ireland and to everyone who dropped a blue token in the box for us!
Hope to see you all next year!











Hi folks, we finished as much of Speedy Spaceship as we could this week. I took it and added a few finishing touches:
My high score has been 71k. See if you can do better!
The code is available from our GitHub, as always. I’m sure the game could be made even more fun with some clever tweaking of speeds and rates. If you give it a go, be sure to let me know.
Thanks for a fun year and I hope we’ll see some of you next year.
This week we are going to try making a measuring device using our HC-SR04 sensors.

First we’ll wire our circuit up.

Next let’s test our circuit with the following code.
from machine import Pin
import utime
from time import sleep
trigger = Pin(17, Pin.OUT)
echo = Pin(16, Pin.IN, Pin.PULL_DOWN)
buzzer = Pin(15, Pin.OUT)
def ultra():
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(5)
trigger.low()
while echo.value() == 0:
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()
timepassed = signalon - signaloff
distance = (timepassed * 0.0343) / 2
print("The distance from object is ", distance, "cm")
return distance
def buzz():
buzzer.value(1)
sleep(0.5)
buzzer.value(0)
sleep(0.5)
while True:
dist = ultra()
if dist < 30:
buzz()
utime.sleep(1)
This week’s challenge is to rewrite the code so the the closer to something the sensor is the faster it will beep.
Once we have that done we will look at transferring the code onto the Pico itself and running it from a battery.
This week we:
A lot of progress! Let’s get into it.

We sourced three audio files:
There are lots of places to find royalty free music and sound online. Freesound.org is one. We placed them in an folder in the project called Audio.
For the game audio, we added an empty game object at the top of our scene called [Audio] and added an AudioSource component to it, setting the clip to our game theme and making sure that Play on Awake and Loop were both set to true.
To have the sound of a missile shooting we added an AudioSource to our Player object and set the clip to our shooting sound and set both Play on Awake and Loop to false. In our ShipController.cs we added a new private property:
private AudioSource _audioSource;
which we then assigned automatically in the Start() function:
void Start()
{
_minTimeBetweenShots = 1.0f / FireRate;
_audioSource = GetComponent<AudioSource>();
}
GetComponent<T>() looks for a component of the requested type (here AudioSource) on the current GameObject and returns it.
Finally, in Shoot(), we added the following:
if (_audioSource != null)
_audioSource.Play();
We wrote a script to destroy something if it hits something else. This is it:
using UnityEngine;
public class DestroyOnContact : MonoBehaviour
{
public GameObject DestroyPrefab;
private void OnTriggerEnter(Collider other)
{
if (DestroyPrefab != null)
{
Instantiate(DestroyPrefab, transform.position,
transform.rotation,
other.transform);
}
Destroy(gameObject);
}
}
The code simply calls Destroy(gameObject) when contact is detected. It also has an optional GameObject called DestroyPrefab. If this is supplied, it will be created at this items current position and rotation, but it will be parented to the thing that was hit, meaning if that thing is moving, then the DestroyPrefab will continue to move with it.
Another simple script that destroys the attached GameObject after a given number of seconds.
using UnityEngine;
public class DestroyAfterSeconds : MonoBehaviour
{
public float TimeToLive = 1.0f;
// Start is called before the first frame update
void Start()
{
Destroy(gameObject, TimeToLive);
}
}
The Destroy() function already has an optional delay argument, so this is very easy to write.
We created our Explosion prefab last week. It was just a quad with a script to keep it always pointing directly at the camera.
To that we added a DestroyAfterSeconds component with a Time To Live of one second and an AudioSource component where the clip was set to our explosion sound, Play on Awake was set to true and Loop was set to false.

The original missile was very small, so we scaled the model part to (3, 3, 3). We then added a BoxCollider, a kinematic RigidBody and a DestroyOnContact component. For the DestroyOnContact component, we set the Destroy Prefab property to our Explosion prefab.

We imported a image of stars into our Textures folder. In the Material folder we created a new Material called StarsSkybox. We changed the Shader to Skybox/Panoramic and assigned our stars image to the Spherical (HDR) slot. We also changed Image Type to 180 degrees.

To assign this skybox to our scene, we used the Window|Rendering|Lighting menu to open the Lighting dialog and set the skybox material at the top of the Environment tab.

We changed the colours of our Environment_main and Environment_details0 materials to #BF4C00 and #EC9100 respectively. We then applied these materials to all our Obstacle prefabs as well.
Finally we increased the intensity of our Directional Light object from 1 to 1.5.
We want our ship to go into a special invulnerable mode after hitting an obstacle. Specifically we want it to:
To achieve this we had to first duplicate the Ship_body and Ship_details materials as Ship_body_transp and Ship_details_transp respectively. On both of these new materials we set the Rendering Mode to Transparent and edited the Albedo to change the Alpha (transparency) value from 255 (solid) to 127 (half transparent).
We then created a duplicate of the Ship model under the Player game object and called it Ship Transparent, we changed it’s materials to the transparent ones and set it inactive by default.
In ShipController.cs we added several new public and private properties:
public GameObject StandardShip;
public GameObject InvulnerableShip;
private bool _shootingDisabled = false;
private Collider _collider;
We added code in Start() to set _collider:
_collider = GetComponent<Collider>();
In Update() we added code to check if we’re allowed to shoot:
// Shooting
if (_shootingDisabled == false &&
_controls.Ship.Shoot.WasPerformedThisFrame())
{
Shoot();
}
Finally we added three more related functions:
private void SetMode(bool isInvulnerable)
{
// Set the ship models on/off
StandardShip.SetActive(!isInvulnerable);
InvulnerableShip.SetActive(isInvulnerable);
// Set shooting on/off
_shootingDisabled = isInvulnerable;
// Set contact on/off
_collider.enabled = !isInvulnerable;
}
public void SetModeNormal()
{
SetMode(false);
}
public void SetModeInvulnerable()
{
SetMode(true);
Invoke("SetModeNormal", 2.0f);
}
The function SetMode() does all the work of switching modes from normal to invulnerable. The two functions SetModeNormal() and SetModeInvulnerable() just call it except that SetModeInvulnerable() also puts in delayed call to SetModeNormal() after two seconds. This means after we go invulnerable, we’ll automatically be vulnerable again after two seconds.
Finally, we just needed to call this in OnTriggerEnter():
private void OnTriggerEnter(Collider other)
{
SetModeInvulnerable();
}
All the code we’re made this year is on our GitHub. It can be found here. If you don’t have the latest version of our code before any session, use the green Code button on that page to get the “Download ZIP” option which will give you a full copy of all code we’ll be writing this year.
This week we did the first week of the Magnify Project, there will definitely be Part 2 and maybe Part 3.
The Magnify project is designed to allow you to create your own detailed Map of something, by magnifying part of the screen to view more information and then Magnify part of that screen to dig even deeper in to your Map.
For example, you might start with an image of the Solar System, showing all the Planets, then you can click on a Planet to see more details. If you clicked on the Earth for example you would be able to see all the countries, and maybe click on a Country to see even more information.
For Part 1 all we did was build a framework with 2 coloured squares that you could click on to Zoom in/Zoom out of.
The code in both squares is identical apart from the Values given to 5 (or 6!) Variables that were defined for that Sprite only.
The Variables are:
MyName – Who am I
MyParent – Who is my Parent
MyLevel – What level do I belong to
MyX – Where am I on the screen
MyY – Where am I on the screen
MyText – What should I say when the Mouse is on me.
Once all these variables are set correctly for each Sprite everything will simply work. For example these are the values that we used for the 2 example Sprites:
| Sprite | MyName | MyParent | MyLevel | MyX | MyY | MyText |
| Sprite1 | Sprite1 | 1 | 100 | 100 | Click Me | |
| Sprite2 | Sprite2 | Sprite1 | 2 | 0 | 0 | Click Me Too. |
You can see that the second Sprite has Sprite1 as the Parent and is a level 2 which is one below Sprite1, these variables basically tell each Sprite whether it should be on show and what size it should be.
To see how it works have a look at the example project on the Scratch Web Site:
https://scratch.mit.edu/projects/1004906611
If you have any questions either here, or make a comment on the project on the Scratch Web Site.
Once the Framework is in place, it is quite easy to add extra levels or sprites at the same level, basically copy either the Parent sprite or another Sprite at the same level you want. Update the Costume with your new image, then simply change the Variables so it has the correct Parent and Level information and it should all work.
Have a think about what you want to Magnify and see if you can gather some images to use. The more images you have the better the project will end up.