Using MIT Scratch for Programming and Control Exercise 2 Controlling movement with the keyboard - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Using MIT Scratch for Programming and Control Exercise 2 Controlling movement with the keyboard

Description:

It is possible to control your sprite using the keyboard arrow keys. ... be set to any angle thereby determining the natural direction of movement of the ... – PowerPoint PPT presentation

Number of Views:160
Avg rating:3.0/5.0
Slides: 10
Provided by: sammyt
Category:

less

Transcript and Presenter's Notes

Title: Using MIT Scratch for Programming and Control Exercise 2 Controlling movement with the keyboard


1
Using MIT Scratch for Programming and
ControlExercise 2 Controlling movement with the
keyboard
  • Year 9 ICT
  • Autumn Term 2007

2
What you will learn
  • In this exercise we will learn
  • how to control the movement of the sprite with
    the keyboard arrows using x and y co-ordinates
  • We can combine this with the previous exercise to
    make the sprite walk around the screen

3
Keyboard control
  • It is possible to control your sprite using the
    keyboard arrow keys.
  • There is a small pointer next to the Sprite
    symbol at the top of the screen which can be set
    to any angle thereby determining the natural
    direction of movement of the sprite.
  • In this exercise we want the Sprite to move
    exactly up and down vertically or side to side
    horizontally so we will use the change x by and
    change y by instructions to order to ensure that
    the Sprite moves exactly horizontally or
    vertically

4
Keyboard control
  • Before completing this exercise dump your
    existing script into the left had side of the
    screen (this will delete it)

5
Keyboard control
  • Now copy the main part of the script then edit
    the sub script for each movement of the mouse
    determined by each of the respective four arrow
    keys

6
Keyboard control
  • Drop the three new copied sets of instructions
    inside the forever instruction (not inside the
    existing If condition instruction)
  • Click the green flag button.
  • It should now be possible to drive your cat
    sprite around the screen using the up, down, left
    and right arrow keys

7
Keyboard control
8
Cat walking with keyboard control
  • Looking back over the previous exercises it
    should be possible to make a script combining
    what you have already learned that allows the Cat
    sprite to walk around the screen.

9
Save your work
  • Save this exercise with the file name catwalk2
Write a Comment
User Comments (0)
About PowerShow.com