20 November 2016

Day Nine - I lost my code!

So, before I start this blog I need to explain my situation before the tragedy. 


I was planning to make a Lego smartphone controlled car with the micro:bit. I can't reveal the code yet though. But I can tel you the design! I would make a Lego car with a flat block long and wide enough to hold a micro:bit. I would then attach Lego wheels to the bottom. With the micro:bit on the car I would  attach a motor to the pins along the bottom of the micro:bit. They would drive a Lego wheel round with the wheel acting as a fan on the edge.

This is how I lost my previous code : I was about to test run my code (from the s mobile app) and then nothing was there! But here is the lesson I learned! Always save your program no matter what. See you next week, Bit by Bit.


13 November 2016

Day Eight - Introduction to Kodu Game Lab with the BBC micro:bit

Today we will be using Kodu Game Lab to create a game where a Kodu collects apples, and every time the Kodu eats an apple the Kodu scores a point. Plus we will be using the BBC micro:bit to control the Kodu.

When you start, click on the Kodu icon. Then double tap and press on the Kodu.

After that right click the Kodu and press 'program'. Under the 'WHEN' tab select the micro:bit icon and next to it press tilt. Under the 'DO' tab put move and quickly.

On the second row, under the when tab, put in bumped and then the apple icon, eat and in the other line put WHEN bumped apple: change score by one.

Then, add in apples using the technique we did for adding in the Kodu. 

Next, press on the brush tool in the bar and drag it while clicking to add in more land.

Then create a balloon and then program it to: When see not apple - Do win.

 And we're done!



6 November 2016

Day Seven - Space Invaders

Hello everyone, bit by bit here and today I will explain how I made a basic Space Invaders game.

 First I will explain the enemy's code. There is a while true block: it's use is like a forever loop. The repeat 4 allows the enemy to move with the change X block and the pause ms slow down the enemy. This apply's for both loops except the other one goes in the opposite direction. 


The bomb mechanism works by changing the y of the bomb. It spawns on the position of the enemy with the set sprite block (it was also used at the top of the section of code, generating the ship at (2,4) and the enemy at (0,0). Then, it immediately fires with the change y block, which is in a repeat 4 block. It is slowed down by 200ms. But if the bomb misses, which the micro:bit can tell with the if statement, y of bomb is bigger or equal to row 4. Next, the bomb is sent back to its original position and its brightness 0 so it isn't seen. Above that is the if statement, bomb touching ship: game over.  Then duplicate it on to the other movement loop.



 OK, so now lets see how the ship is controlled. There is a when button A pressed: change  x of  ship by -1. This is the same for when B is pressed except -1 is 1.

Now, lets get on to the ship's firing system. When A + B are pressed together, missile is generated at ship, then there is a repeat 4 loop under and the y of the missile is changed by  -1 (or up as the micro:bit grid is the opposite of our up.) The next if statement is similar to the bomb one. If missile is equal to or greater than 0, it resets the position and the brightness is 0. In the first if statement is a second, if missile is touching enemy: change score by one.


My channel: https://www.youtube.com/channel/UCBM75CLZnKs5J2Ri2UpmAg