I mentioned in my last post how proud I am of my son who got his junior black belt in karate.
Well this time I need to mention my daughter Ellen who got through to the finals of the 2014 Scratch competition!
This seems to be the fourth year that this competition has been run.
Apparently there were almost 1000 entries from all over Ireland and 5 are going through to the finals in each of 5 categories.
In CoderDojo Malahide we encouraged the kids to enter the competition and I'm delighted to say that we have a second finalist: Joshua Murray who is in the 4th year to 6th year category.
Ellen's entry can be seen here and Joshua's here.
Well done Ellen, Joshua, and CoderDojo Malahide!
More details of the competition and the finalists are available here. The finals will be held on the 2nd of May.
Showing posts with label Scratch. Show all posts
Showing posts with label Scratch. Show all posts
Friday, 18 April 2014
Monday, 6 January 2014
Scratch 2 - Renaming a Sprite
I have forgotten this a few times so I'm going to blog about it to remind myself!
In Scratch 2, renaming a Sprite (or changing its other properties) is no longer intuitive.
To do it, you need to:
No idea what they were thinking when they made this design decision.
In Scratch 2, renaming a Sprite (or changing its other properties) is no longer intuitive.
To do it, you need to:
- Select the sprite in the Sprites pane
- Click on the little "i" in the top left hand corner
- Make whatever changes you need
- Click on the arrow head to return to the normal Sprites pane
No idea what they were thinking when they made this design decision.
Labels:
Computing,
Programming,
Scratch
Friday, 11 October 2013
Design Oversight in Scratch 2
There is a problem in Scratch 2 where you cannot easily differentiate between variables that are global (shared by all sprites) and those that are local to the current sprite.
In the old version these were separated by a dividing line.
The screenshot below shows the three types of variable that are available in the online version.
Cloud variables have a cloud icon to differentiate them. Local and global variables look the same.
The workaround which can be seen in the screenshot is to make the variables visible temporarily on the screen. Then local variables are prefixed by the name of the sprite of which they are members.
In the old version these were separated by a dividing line.
The screenshot below shows the three types of variable that are available in the online version.
Cloud variables have a cloud icon to differentiate them. Local and global variables look the same.
The workaround which can be seen in the screenshot is to make the variables visible temporarily on the screen. Then local variables are prefixed by the name of the sprite of which they are members.
Scratch 2 Offline Editor
I mentioned in a posting back in May that Scratch 2 had been released without the offline editor.
Well this has been rectified now and the editor can be download from here.
It is still described as "Beta Version".
The only thing I have spotted that you can do in the Online version and not in Offline version is to declare and access "Cloud variables".
Here is an image of the offline client:
Well this has been rectified now and the editor can be download from here.
It is still described as "Beta Version".
The only thing I have spotted that you can do in the Online version and not in Offline version is to declare and access "Cloud variables".
Here is an image of the offline client:
Saturday, 25 May 2013
Scratch 2.0 - Where I think they have gone wrong
I have a number of issues and reservations about the new version of Scratch - Scratch 2.0.
1) Use of Adobe Flash
The first issue is that the development environment is now online and is based on Adobe Flash.
This continues a trend which we saw with the previous version of Scratch where the online environment moved from using a Java Applet to view games to using Flash. You could still switch to the Java Applet but the default was to use the Flash player. In 2.0 the support for the Java Applet on the Scratch website has disappeared completely.
The Flash player is a technology which is on its last legs, IMO. The beginning of the end was when Apple release the iPhone and there was no flash support. YouTube responded by providing an alternative to Flash for iPhone users. The middle of the end was when Steve Jobs wrote his "Thoughts on Flash" open letter in April 2010 and then Adobe announced in November 2011 that it will no longer develop Flash for mobile platforms. Mobile is everything these days. The end of the end cannot be far off.
Interestingly, the University of California at Berkeley has created SNAP! (formerly known as BYOB for "Build Your Own Blocks") which is described as an "extended reimplementation of Scratch". It doesn't use Flash. In fact it just uses JavaScript. The amazing thing is that it actually runs in iOS. I have used it on a iPad (even though Apple try to limit people's ability to develop code on an iPad). To be frank I think that UCB have outsmarted MIT. You can access SNAP! here.
2) Lack of "offline client"
The Scratch site says that an offline client will be available "early in the summer". This is a little vague for my liking. I think being able to work online is great, but being able to work offline is essential. That's how IDEs are supposed to work, IMHO.
When we teach Scratch in CoderDojo, we like everyone to be able to run Scratch independently. We don't want to have to give all of the kids Internet access.
As if that weren't enough, Scratch 2.0 uses a different file format. So while you can still develop in Scratch 1.4 and upload programs to the Scratch website, you can no longer download them to work offline.
So pending the release of the new offline client, you can no longer download and remix other people's programs using the offline client.
In summary, I think the Scratch team has lost its way a little and they have made a couple of pretty serious strategic and tactical errors with the current release. How damaging they will be remains to be seen.
1) Use of Adobe Flash
The first issue is that the development environment is now online and is based on Adobe Flash.
This continues a trend which we saw with the previous version of Scratch where the online environment moved from using a Java Applet to view games to using Flash. You could still switch to the Java Applet but the default was to use the Flash player. In 2.0 the support for the Java Applet on the Scratch website has disappeared completely.
The Flash player is a technology which is on its last legs, IMO. The beginning of the end was when Apple release the iPhone and there was no flash support. YouTube responded by providing an alternative to Flash for iPhone users. The middle of the end was when Steve Jobs wrote his "Thoughts on Flash" open letter in April 2010 and then Adobe announced in November 2011 that it will no longer develop Flash for mobile platforms. Mobile is everything these days. The end of the end cannot be far off.
Interestingly, the University of California at Berkeley has created SNAP! (formerly known as BYOB for "Build Your Own Blocks") which is described as an "extended reimplementation of Scratch". It doesn't use Flash. In fact it just uses JavaScript. The amazing thing is that it actually runs in iOS. I have used it on a iPad (even though Apple try to limit people's ability to develop code on an iPad). To be frank I think that UCB have outsmarted MIT. You can access SNAP! here.
2) Lack of "offline client"
The Scratch site says that an offline client will be available "early in the summer". This is a little vague for my liking. I think being able to work online is great, but being able to work offline is essential. That's how IDEs are supposed to work, IMHO.
When we teach Scratch in CoderDojo, we like everyone to be able to run Scratch independently. We don't want to have to give all of the kids Internet access.
As if that weren't enough, Scratch 2.0 uses a different file format. So while you can still develop in Scratch 1.4 and upload programs to the Scratch website, you can no longer download them to work offline.
So pending the release of the new offline client, you can no longer download and remix other people's programs using the offline client.
In summary, I think the Scratch team has lost its way a little and they have made a couple of pretty serious strategic and tactical errors with the current release. How damaging they will be remains to be seen.
Labels:
Computing,
Programming,
Scratch
Tuesday, 21 May 2013
Scratch 2.0 Released
After what seems like an age in "Beta", Scratch 2.0 has been released.
Perhaps the biggest change is that you edit the programs online now (using Flash). The new version of the offline editor is due "this summer" apparently.
Other changes include:
1) You can clone a sprite. This has great potential for people who want to write "Space Invaders", for example (I have great admiration for the people who wrote version of this game when you couldn't clone sprites). I'm not entirely sure how this would work in practice though (there are no class variables, no way to pass parameters to a constructor, and no way to "block" other threads when updating a variable).
2) You can create your own blocks. This is obviously good as it gives you the basis of writing your own methods/subroutines.
3) You can store numbers in "cloud variables". This is useful for having high scores which work across all players, for example.
4) You can access the user's webcam. Sounds good in principle (you could write games a little like on the PS2 EyeToy) but I haven't really had time to play with it yet.
I guess that covers some of the good news. I'll cover some of my negative thoughts in my next posting.
Perhaps the biggest change is that you edit the programs online now (using Flash). The new version of the offline editor is due "this summer" apparently.
Other changes include:
1) You can clone a sprite. This has great potential for people who want to write "Space Invaders", for example (I have great admiration for the people who wrote version of this game when you couldn't clone sprites). I'm not entirely sure how this would work in practice though (there are no class variables, no way to pass parameters to a constructor, and no way to "block" other threads when updating a variable).
2) You can create your own blocks. This is obviously good as it gives you the basis of writing your own methods/subroutines.
3) You can store numbers in "cloud variables". This is useful for having high scores which work across all players, for example.
4) You can access the user's webcam. Sounds good in principle (you could write games a little like on the PS2 EyeToy) but I haven't really had time to play with it yet.
I guess that covers some of the good news. I'll cover some of my negative thoughts in my next posting.
Labels:
Programming,
Scratch
Sunday, 10 March 2013
What I would change in Scratch
If I could wave a magic wand and change one thing about Scratch...
It wouldn't be any of the things I have mentioned previously: FOR loops, FLOOR and CEILING functions, different method for handling layers.
It wouldn't be the facility to clone sprites. It wouldn't be the facility to write subroutines and functions.
Note: Some of these have been addressed in Scratch 2.0 which is currently in Beta and all of them would be on my wish-list.
Instead it would be to reverse a decision which I'm sure the designers made with the best of intentions. It would be to allow you to move a sprite completely off the "stage".
The designers decided obviously that having a sprite which if off the stage would be confusing for kids. So if you instruct a sprite to move off the stage it will only do so partially - the x/y coordinate will simply refuse to increase/decrease past a certain point.
This is annoying where you want to:
1) Have a sprite glide onto or off the stage
2) Work with scrolling backgrounds
So yes: if I could do one thing then that would be it.
And no: this has not been changed in version 2.0.
This picture shows how you cannot get the Scratch Cat to exit the stage no matter how many times you press the space key:
It wouldn't be any of the things I have mentioned previously: FOR loops, FLOOR and CEILING functions, different method for handling layers.
It wouldn't be the facility to clone sprites. It wouldn't be the facility to write subroutines and functions.
Note: Some of these have been addressed in Scratch 2.0 which is currently in Beta and all of them would be on my wish-list.
Instead it would be to reverse a decision which I'm sure the designers made with the best of intentions. It would be to allow you to move a sprite completely off the "stage".
The designers decided obviously that having a sprite which if off the stage would be confusing for kids. So if you instruct a sprite to move off the stage it will only do so partially - the x/y coordinate will simply refuse to increase/decrease past a certain point.
This is annoying where you want to:
1) Have a sprite glide onto or off the stage
2) Work with scrolling backgrounds
So yes: if I could do one thing then that would be it.
And no: this has not been changed in version 2.0.
This picture shows how you cannot get the Scratch Cat to exit the stage no matter how many times you press the space key:
Labels:
Computing,
Programming,
Scratch
Friday, 8 March 2013
Scratch Programming - Layers
All sprites in Scratch have three coordinates: x, y and z.
The x and y can be set directly:
The z cannot be set directly but can be adjusted by changing the sprites layer. This is not as intuitive as it might be (well it certainly confused me for a while).
I imagined that a sprites layer number would work in a similar manner to the x and y coordinates. So a sprite which has been told to "go back 5 layers" would be behind one which has been told to "go back 3 layers".
The reality is that every sprite has a unique layer. When you tell a sprite to "go to front" it does just that. It takes a position in front of all other sprites (let's call this layer 1). The sprite that was on layer 1 moves back to layer 2 and so on down the line.
When you tell a sprite to "go back 1 layers", it basically swaps places with the sprite that was behind it.
When you tell a sprite to "go back -1 layers" (you can use negative numbers) it swaps places with the sprite that was in front of it.
So basically all layers are relative, not absolute.
I added the following code blocks to a sprite in a 2 sprite program:
When you press "a" the sprite goes behind the other sprite.
When you press "b" it comes back to the front again (you do not have to press "b" twenty times!!)
The x and y can be set directly:
The z cannot be set directly but can be adjusted by changing the sprites layer. This is not as intuitive as it might be (well it certainly confused me for a while).
I imagined that a sprites layer number would work in a similar manner to the x and y coordinates. So a sprite which has been told to "go back 5 layers" would be behind one which has been told to "go back 3 layers".
The reality is that every sprite has a unique layer. When you tell a sprite to "go to front" it does just that. It takes a position in front of all other sprites (let's call this layer 1). The sprite that was on layer 1 moves back to layer 2 and so on down the line.
When you tell a sprite to "go back 1 layers", it basically swaps places with the sprite that was behind it.
When you tell a sprite to "go back -1 layers" (you can use negative numbers) it swaps places with the sprite that was in front of it.
So basically all layers are relative, not absolute.
I added the following code blocks to a sprite in a 2 sprite program:
When you press "a" the sprite goes behind the other sprite.
When you press "b" it comes back to the front again (you do not have to press "b" twenty times!!)
Labels:
Computing,
Programming,
Scratch
Monday, 11 February 2013
Scratch - What's Missing
In this posting I want to talk about two things that are missing from the current version of Scratch (I'll also mention the upcoming version).
Before I start I want to acknowledge that the designers of Scratch were anxious to keep the environment simple so that newcomers and kids would not find it too confusing. So the omissions that I am highlighting here were no doubt conscious decisions by the designers. But for people who are used to other languages they are very surprising (and quite annoying to be honest).
The first is that there is no FOR loop.So if you want to perform a loop X times while changing a variable from 1 to X with each iteration, you have to do that yourself. So you need to set the initial value, check against the limit, and increment the variable by hand each time yourself.
In Whack-a-Bird I needed to a nested FOR look to move across the 3x3 matrix of holes while drawing them. Here is now the code ended up (this would have been a lot tighter if there were a FOR block):
In the new version of Scratch (2.0 - currently in beta) there is still no FOR loop!
The second omission is that you can only convert a floating point number to an integer using the ROUND block. There is no block for truncating or rounding down. This is a big omission for games writing.
For example, if you want to convert a number to two components to work with a 4x4 matrix, you will use division and the modulo function to get the two components. In Java it would look like this:
int y=number/4;
int x=number % 4; // % in Java is the remainder or modulus or modulo operator
Here is how that would look in Scratch. The second line will work as expected but unfortunately the ROUND block will change the answer by rounding up the result when you don't want it to:
The good news is that this HAS been addressed in Scratch 2.0 which, in addition to a ROUND function, has both CEILING and FLOOR functions.
Before I start I want to acknowledge that the designers of Scratch were anxious to keep the environment simple so that newcomers and kids would not find it too confusing. So the omissions that I am highlighting here were no doubt conscious decisions by the designers. But for people who are used to other languages they are very surprising (and quite annoying to be honest).
The first is that there is no FOR loop.So if you want to perform a loop X times while changing a variable from 1 to X with each iteration, you have to do that yourself. So you need to set the initial value, check against the limit, and increment the variable by hand each time yourself.
In Whack-a-Bird I needed to a nested FOR look to move across the 3x3 matrix of holes while drawing them. Here is now the code ended up (this would have been a lot tighter if there were a FOR block):
In the new version of Scratch (2.0 - currently in beta) there is still no FOR loop!
The second omission is that you can only convert a floating point number to an integer using the ROUND block. There is no block for truncating or rounding down. This is a big omission for games writing.
For example, if you want to convert a number to two components to work with a 4x4 matrix, you will use division and the modulo function to get the two components. In Java it would look like this:
int y=number/4;
int x=number % 4; // % in Java is the remainder or modulus or modulo operator
Here is how that would look in Scratch. The second line will work as expected but unfortunately the ROUND block will change the answer by rounding up the result when you don't want it to:
The good news is that this HAS been addressed in Scratch 2.0 which, in addition to a ROUND function, has both CEILING and FLOOR functions.
Labels:
Computing,
Programming,
Scratch
Second Scratch Game - Whack-a-Bird
The second Scratch game I wrote, and the first I "shared" on the Scratch website, was called "Whack-a-Bird".
I've always liked whack-a-mole games (both the real and the computer versions) and I thought it would be a nice one to do with sprites (controlling position, appearance and detecting clicks).
I decided quite early on that the "mole" should be one of the red angry birds. Then one of my kids reminded me that there should be some targets that you should not want to hit and the black (exploding) angry bird was the obvious candidate.
I used to play a game called "Boulder Dash" back in the 80's and the main character ("Rockford") used to tap his foot if you didn't get on with the game. This made me think that I should animate the splash screen in some way so I put on of the birds onto it and I had him look from left to right continuously. Then I was wondering where to put the instructions so I had him "say" them randomly while waiting for the game to start.
In my version you have 2 minutes for the game, things speed up as time runs down, and then game ends if you miss 10 birds. You can play it here.
Once I had "finished" the game, I decided that an important element was missing - the possibility to have multiple birds popping up at the same time. The obvious solution to this is to have 9 sprites - one per hole. This would be the right solution if you could "clone" sprites during the game but (since you can't in the current version of Scratch) you would need to duplicate the sprite in the designer. I though this was a bit of a cop-out. In the end I created 4 copies of the sprite and I position them randomly into the 9 positions. This version of the game is much harder/more challenging. You can play it here.
I've always liked whack-a-mole games (both the real and the computer versions) and I thought it would be a nice one to do with sprites (controlling position, appearance and detecting clicks).
I decided quite early on that the "mole" should be one of the red angry birds. Then one of my kids reminded me that there should be some targets that you should not want to hit and the black (exploding) angry bird was the obvious candidate.
I used to play a game called "Boulder Dash" back in the 80's and the main character ("Rockford") used to tap his foot if you didn't get on with the game. This made me think that I should animate the splash screen in some way so I put on of the birds onto it and I had him look from left to right continuously. Then I was wondering where to put the instructions so I had him "say" them randomly while waiting for the game to start.
In my version you have 2 minutes for the game, things speed up as time runs down, and then game ends if you miss 10 birds. You can play it here.
Once I had "finished" the game, I decided that an important element was missing - the possibility to have multiple birds popping up at the same time. The obvious solution to this is to have 9 sprites - one per hole. This would be the right solution if you could "clone" sprites during the game but (since you can't in the current version of Scratch) you would need to duplicate the sprite in the designer. I though this was a bit of a cop-out. In the end I created 4 copies of the sprite and I position them randomly into the 9 positions. This version of the game is much harder/more challenging. You can play it here.
Saturday, 9 February 2013
My first Scratch game
The first game I wrote in Scratch was called Tank and was extremely simple.
I decided to take advantage of the fact that sprites could turn in any direction, and move in that direction, and could be resized.
The idea is to steer a tank to fire on targets which appear in random positions.
The game, as I said, is simple and only has 6 sprites (3 being the tank, the target, and the missile) and 22 scripts. There is a timer which counts down from 60 seconds and you can move from level 1 to 5 as your score increases (with the target getting smaller each time).
You can steer and move with the arrow keys. Late on in dveelopment I added the facility to aim the tank using the mouse (and in so doing created my first checkbox!).
There are still a couple of bugs in it (you can still control the tank even after the game is over, and the target can appear behind the variables at the top of the screen).
Even though it is simple, my kids enjoyed playing it. You can play it here.
I decided to take advantage of the fact that sprites could turn in any direction, and move in that direction, and could be resized.
The idea is to steer a tank to fire on targets which appear in random positions.
The game, as I said, is simple and only has 6 sprites (3 being the tank, the target, and the missile) and 22 scripts. There is a timer which counts down from 60 seconds and you can move from level 1 to 5 as your score increases (with the target getting smaller each time).
You can steer and move with the arrow keys. Late on in dveelopment I added the facility to aim the tank using the mouse (and in so doing created my first checkbox!).
There are still a couple of bugs in it (you can still control the tank even after the game is over, and the target can appear behind the variables at the top of the screen).
Even though it is simple, my kids enjoyed playing it. You can play it here.
Labels:
Programming,
Scratch
Scratch - A great programming environment
Scratch is a programming language/environment which was developed in 2006 at the MIT Media Lab.
It was designed to help kids to learn to program by allowing them to get results fast. It supports "Sprites" and when you launch the program it starts with this sprite already loaded:
In Scratch you don't write code by typing it in. Instead you drag "blocks" from the "Block palette" into the "Script area" and you join them with other blocks.
Here are some very simple examples of how easy it is to get your sprite to do something. The one on the left is the classic "Hello World". The one on the right will simply move your sprite to the right. Both are triggered by clicking on the sprite:
The great things about Scratch in my opinion are:
But that's not all. The third item in the drop-down menu (after File and Edit) is "Share". Scratch is designed to allow you to share your projects with other people and to run the programs which they have written. You can search for other programs and you can even run them directly on the web page (thanks to Flash and Java players). And if you see a program that you think you could learn something from, then you can download it and see how it works. And you are free to enhance the program which you have downloaded and to upload your own version. Genius!
Scratch can be used to create interactive stories, animations, games, music, and art. You can do simple things with it, and you can also do complex things. Here are links to some classic games written in Scratch which you can run directly from the web page with no download:
Pacman
Space Invaders
Asteroids
To finish up this posting, here's a little piece of code which should make sense even if you don't know Scratch:
It was designed to help kids to learn to program by allowing them to get results fast. It supports "Sprites" and when you launch the program it starts with this sprite already loaded:
In Scratch you don't write code by typing it in. Instead you drag "blocks" from the "Block palette" into the "Script area" and you join them with other blocks.
Here are some very simple examples of how easy it is to get your sprite to do something. The one on the left is the classic "Hello World". The one on the right will simply move your sprite to the right. Both are triggered by clicking on the sprite:
The great things about Scratch in my opinion are:
- It is easy to create and manipulate sprites, and to respond to events
- Because you are dragging in code blocks, you can't really make syntax errors (although you can still have bugs of course!)
- It is easy to integrate sound (audio files, drums, and other instruments)
- The development environment is very good
- You can get results quickly
- It's fun!
But that's not all. The third item in the drop-down menu (after File and Edit) is "Share". Scratch is designed to allow you to share your projects with other people and to run the programs which they have written. You can search for other programs and you can even run them directly on the web page (thanks to Flash and Java players). And if you see a program that you think you could learn something from, then you can download it and see how it works. And you are free to enhance the program which you have downloaded and to upload your own version. Genius!
Scratch can be used to create interactive stories, animations, games, music, and art. You can do simple things with it, and you can also do complex things. Here are links to some classic games written in Scratch which you can run directly from the web page with no download:
Pacman
Space Invaders
Asteroids
To finish up this posting, here's a little piece of code which should make sense even if you don't know Scratch:
Labels:
Computing,
Programming,
Scratch
Subscribe to:
Posts (Atom)
