Scratch exercise 13

Random stage location

Complete these steps ..

1. Create a new game. Either open Scratch or if it is already open choose "File>New" ..

 

Now re-name sprite1 "Cat".

 

 

2. Move your mouse-pointer to the centre of the stage. Look in the bottom right corner of the stage and try to get x:0 and y:0. This is the center of the stage. Move your mouse-pointer around slowly and watch the x and y numbers change.

 

 

3. We are going to start by making the cat appear somewhere along the bottom edge of the stage. The stage is 480 pixels wide (x: -240 to 240).

Add these script to the Cat sprite ..

Press the "B" key to begin your game. Every time your press the "B" key the cat will jump to a random location along the bottom of the screen.

 

 

4. Now let's make the cat appear somewhere along the right edge of the stage. The stage is 360 pixels high (y: -180 to 180).

Add these script to the Cat sprite ..

Press the "B" key to begin your game. Every time your press the "B" key the cat will jump to a random location along the right edge of the screen.

 

 

5. Let's make the cat jump to a random location anywhere on the stage.

Add these script to the Cat sprite ..

 

 

5. Go to "File > Save as" and save your game. Name it "Random stage location"