20.03.2013 Views

Introduction to Computer Science with Scratch and App Inventor

Introduction to Computer Science with Scratch and App Inventor

Introduction to Computer Science with Scratch and App Inventor

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The sensing menu contains many blocks that test different<br />

conditions. The one that we are going <strong>to</strong> use <strong>to</strong> help control our<br />

sprite checks <strong>to</strong> see if a certain key is pressed. The default key is<br />

the space bar, but we can change it <strong>to</strong> select any key we want by<br />

clicking on the arrow <strong>to</strong> bring up a drop down menu<br />

Here the arrow keys are<br />

the ones that we want <strong>to</strong><br />

use in our condition<br />

since they will tell our<br />

sprite which direction <strong>to</strong><br />

move on the stage.<br />

Now that we know where <strong>to</strong> find the condition blocks, let’s use if, conditions, <strong>and</strong> movement blocks <strong>to</strong><br />

build a user controlled sprite. What do you think our script will look like?<br />

Here is one example of a script that will work for<br />

creating a user-controlled dinosaur. You can write<br />

a script that does the exact same thing that looks<br />

very different – in programming there are often<br />

lots of different ways <strong>to</strong> do the same thing – that is<br />

OK. The different ways <strong>to</strong> approach the same<br />

problem are called algorithms. Coming up <strong>with</strong><br />

good algorithms <strong>to</strong> solve a problem is a big part of<br />

what programmers do.<br />

mbrace Game Development Workbook Page 14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!