Tuesday, September 23, 2014

Scratch Programming Tips





This code is the most basic way of making a character count to 10 that there is on scratch. This code tells the sprite to say 1, then when it is done with that, say 2, then 3 and so on. This code will work but it takes up a lot of space and if we wanted the sprite to count to 100 we would have to put 100 commands to make it say each number individually. 
.







This second code does the exact thing as the first one but is more effective and easy to use is several ways. First of all, this code may look complicated but actually is very simple. This code has a variable called 'Counter' and at the start this variable is set to 0 but once the code has started it will be changed to 1 and the sprite will be told to say whatever the variable 'Counter' is at that moment, so the sprite will say 1. This is repeated with a repeat command but the variable 'Counter' is changed to 2, so the sprite will say 2. This is repeated 10 times (until the variable is 10 so the sprite says 10). If i wanted to change the number the sprite is counting to, I would only have to type it in to the repeat command so I could have the sprite count to 189473 and all I would have to do would be to type it, however in the first code, i would have to make 189473 more commands.








if you want to try this please click here