Thank you all for coming on Saturday. I hope you liked the short video of the SpaceX Falcon Heavy Test Launch and the Intel Light Drones from the opening Ceremony of the Winter Olympics.
This week we did a new game, How fast can you Type? Last week we used Sprites as backgrounds and this week we used Backgrounds as Sprites. Just to mix it up!
We used a variable as our Timer, our first time doing this, don’t forget if you want the time to start when you press the first letter rather than when the green flag is clicked then you are going to have to add another broadcast.
We are off for the next two weeks, to cover the school mid term break and also as Confirmation for all the Athenry Schools takes place on the 24th of February and there will be many families attending this from Coderdojo Athenry. Best wishes to any of our Ninjas and families who are being confirmed.
Hope you all have a great break and hope to see you all back on the 3rd of March
Last Saturday we had a look at how we might figure out how far and how fast a bike is going using a Raspberry Pi. We used a very basic set up with just a micro-switch attached to a toy trike with a little nut taped to the front wheel, each time the wheel rotates the nut would “click” the micro-switch.
We would need to use a reed switch or a hall effect sensor and a magnet attached to the wheel if we were to use this on a real bike.
We started of our coding by looking at the time.time() function. This function returns the number of seconds, in decimal form, since 01 January 1970. If we want to time an event all we have to do is use time.time() to get the start time and use it again to get the end time and then subtract the the start time from the end time.
We used this to get the the amount time it takes to do one rotation. Now we want to find out how many rotations we have per minute or RPM (revolutions per minute). As our result is in seconds the easiest thing to do is calculate revs per second so we divide 1 by the time it takes to do 1 rotation and then multiply the answer by 60 to get RPM.
Now we wanted to get KPH(kilometres per hour) so first we measured the circumference of the wheel and found it was 50cm or 0.5 Metres. We then calculated metres per minute by multiplying our RPM by 0.5 and we then multiplied this by 1000 to get KPH.
Here’s a picture of what our results could look like when displayed using Pygame. We will look at Pygame later on as it’s an excellent way of displaying information.
Today in Creators, we took another look at our old friend Random and discovered that there are many kinds of random that can be used for different things (this wiki page has a surprisingly long list of other types of random … Continue reading →
This week in Advancers, Oliver was out so Mark covered. We built a platform game engine which will be really useful for powering all sorts of games and projects! Download the completed Scratch Platform Game here!! How did we build … Continue reading →
Thank you all for coming again on Saturday and welcome to our new people!
This week we looked at some of the elements we will use in A Mario game we will make in a couple of weeks time. We will use scrolling of objects in the background to achieve movement rather than making the Sprite itself move as we would normally do. It can be a difficult concept to grasp for the younger ones, but we will go through it again before we make the Mario game.
Firstly we select our Sprite and we decided we would only move left and right.
We then had to create some Backgrounds. NOTE: EACH BACKGROUND IS A SPRITE. You do not create it as you normally would.
Last week in the Bodgers group we began by looking at our new keyboards and Touchscreens. These will allow us to easily design touch based projects and projects that need a monitor. They will also be invaluable at the start of next years sessions as we can get our code on the Raspberry Pi straight away without any need to connect our laptops.
We also started planning our next project with a short brainstorming session and we have a couple of ideas we will develop further this week.
Direction and turning
We assign numbers to represent directions on the screen. Zero is right, one is up, two is left and three is down. Note then that if the snake is heading right (in the screen sense) and turns left it goes to up (in the screen sense); direction goes from zero to one. Similarly, if going up (in the screen sense) and it turns left then it goes to left (in the screen sense).
Generally then we note that turning to the left makes the direction number get bigger while turning to the right makes it get smaller. This rule hold until we get to a number bigger than three or smaller than zero; these make no sense. If direction is at zero and the snake goes right, we set direction to three. Similarly, if direction is at three and we turn left, we set direction to zero.