Squeakland Bouncer

This week we will make a ball move around the screen, but stay inside four invisible 'walls'. We will create a script that loops, making the balls move left/right & up/down in steps of 20 pixels (screen dots).

A variable is a word that represents a number. We will create two variables called xstep and ystep for the distance the ball should move along the x axis and up the y axis.

At each step the script will:

  • Add xstep to the ball's x
  • Add ystep to the ball's y
  • If we've reached the 'right' wall, change xstep to +20
  • If we've reached the 'left' wall, change xstep to -20
  • If we've reached the 'top' wall, change ystep to -20
  • If we've reached the 'bottom' wall, change ystep to +20

This means when we're adding '20' the ball moves right/up, when we're adding -20 we're moving left/down.

Build the script

1. Open the 'Supplies' tab and drag an ellipse (oval) onto the screen.

2. Hover over the ellipse to make the handles appear

3. Change its name to 'ball'

4. Open a viewer for 'ball'

5. Select the 'Geometry' menu ('geometry' means shape) and set ball's width and length to 40

6. Drag out a script, call it 'bounce'

7. Add 4 yellow 'test' boxes into the script

8. Click the small 'v' button at the top of ball's viewer to create a 'variable' (a word that represents a number that can be changed). Call it 'xstep'. Create another called 'ystep'.

9. Now build the following script by dragging each part into the test boxes:

Test the script

1. Press the clock to 'run' the script

2. Stop the script, select the 'Pen' menu and turn on the pen. Run the script.

3. Stop the script, change the colour. Move the ball and start the script again.

4. Try changing the numbers in the script. What happens?


Related pages: Squeakland

Category: ICT

Author: Mr Kershaw

Pages that link to 'Squeakland Bouncer': Squeakland

 
 
Bradford Christian School,
Livingstone Road, Bolton Woods, Bradford, West Yorkshire BD2 1BT
Tel: 01274 532649   Fax: 01274 595819
Email: school office | webmaster

[Bradford Christian School]

Web search
2008
Fri 20th June
Variety Show 2008
Mon 23rd
Romania Group 2 Slack Top Mission Week
Tues 24th
Y9 & Y10 Dutch project week
Thu 26th
Class 3 WW2 Day
Mon 30th
Class 1 Consultations
Tues 1st July
Y9 GCSE Options & parent consultation
Weds 2nd
Induction day Primary & middle
Fri 4th
Year 8 Barmitzvah meal and presentation
Tues 8th
6.30pm Annual Partnership meeting
Weds 9th
Primary sports afternoon
Fri 18th July
Close for Summer Holiday
Tue 2nd Sept
School opens

Regular Meetings

Old News

Term Dates

Add/edit events