Scratch Advanced – Week 9 – Christmas Game Part 2

What are we going to learn about this week.

1. Code reuse
2. Testing and Debugging
3. Exams!

1. Code Reuse – how to plan ahead and only write something once, remember the button we did that we exported and used again in other projects? Well, you can do the same kind of thing
within Scratch if you need several Sprites to do exactly the same thing.

First you create one Sprite and add all the code that you need for that one Sprite.

When you are happy with the way that Sprite works then just right click on the Sprite and select duplicate. The key to getting the best out this of this functionality is to ensure that the first Sprite that you have done has everythin working correctly.

2. Testing and Debugging – This is normally done using the original requirements, you basically go through the list of things that the Game should do and tick them off if it works. It helps if you have the list written down and then you know what you are testing.

And, it also helps if you get someone else to test your Game, as they will test it differently to you.

So here is the list of requirements from last week:

1.It needs to look like my living room with a nice window and lovely fire place.
2.At Christmas, when you look out the window it is normally snowing.
3.We normally have our tree in the corner, with a nice set of lights on it.
4.Santa normally flies across the top of the house and drops the presents down the chimney, lately he has not had a good aim, so we will need to be able to move the fireplace left and right.
5.If we catch the presents, we can move them to under the tree.
6.I don’t want the game to last more than two minutes.
7.And when it ends I want to know what all the Presents are.

It’s best to use Presentation Mode to do your testing.

And go through each item on it’s own. At the moment we haven’t completed all the code for everything, so you can only test the parts that are complete.

If it passes, perfect, if not, it’s time to start debugging.

Debugging, the first thing to do is run your test again, to confirm that it’s not working. There are two very important things to know here:

1. What SHOULD happen – this is what is described in the list of requirements.
2. What is happening – this is the result of your test.

When you have those two bits worked out, you can start looking at the code to see what is wrong.

In Scratch, it is possible to see which piece of code is actually running, this is done using the Edit – Start Single Stepping.

Try it out, but DON’T use the Green Flag to start everything, just click on one of the Control Blocks to start that one piece of code.

3 Exams – ok, don’t panic, but it is that time of year again.

We are all going for the Blue Belt this time, and your knowledge will be tested on what we have learnt in the last 8 weeks. Here is a refresher of the things that we have covered:

Week 1. Movies.
Week 2. Sliders and Buttons
Week 3. Random Numbers, Stamping, Saving Images.
Week 4. Exporting Sprites
Week 5. Code Reuse – Parallel and Sequential Programming.
Week 6. Lists, for saving data and reading it out.
Week 7. Code Modules, using LIsts as a Database.
Week 8. Coding to Requirements.

One thought on “Scratch Advanced – Week 9 – Christmas Game Part 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s