· web viewtype to change the word “hello” to “don’t push the button ... for this we will...

13
DON’T Push THE BUTTON! ROOK 10 Start a new SCRATCH project. Right click on the SCRATCH kitty and delete this SPRITE. CREATE A NEW BUTTON Click on the PAINT NEW SPRITE button. This opens up the PAINT EDITOR

Upload: nguyennhan

Post on 04-Apr-2018

227 views

Category:

Documents


4 download

TRANSCRIPT

Page 1:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

DON’T Push THE BUTTON!

ROOK 10

Start a new SCRATCH project.

Right click on the SCRATCH kitty and delete this SPRITE.

CREATE A NEW BUTTON

Click on the PAINT NEW SPRITE button.

This opens up the PAINT EDITOR

Use the PAINT EDITOR to create two pictures of a button push. One for “up” one for “down”.

First the “down”

Page 2:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Click OK. We have created the “down” version of SPRITE 1.

With SPRITE 1 selected go to the COSTUMES TAB

Click the COPY button to create a second costume for the button.

Page 3:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Now lets click the EDIT button OF THE FIRST COSTUME to create the “UP” look.(WE ARE CHANGING THE FIRST COSTUME – CREATING AN UP LOOK – WE WANT IT FIRST IN THE COSTUME ORDER BECAUSE THE BUTTON STARTS IN THE UP POSITION – HOWEVER THE ORDER DOESN’T MATTER AS LONG AS WE HAVE THE BUTTONS NAMED CORRECTLY)

Use the PAINT EDITOR create the look for the up button.

When you are finished you should have two COSTUMES for SPRITE 1.

Name them “up” and “down” accordingly.

Page 4:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

One last fix for the button. We need to set the COSTUME CENTER of the “up” button so that it will match the “down” version. This will help our animation look more believable.

Click the EDIT button for the “up” COSTUME.Select the SET COSTUME CENTER button. This will bring up a CROSSHAIR pointer.

Using the mouse, move the CROSSHAIR down to the center of the bottom of the button image.

PROGRAM THE BUTTON PUSH

First lets set up the beginning game conditions. The game is started by the green flag. When the green flag is clicked we want a new (clear) screen with our “up” big red button right in the middle of it.

Go to the SCRIPTS tab for SPRITE 1.

Page 5:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Under the yellow CONTROL section grab the “WHEN GREEN FLAG CLICKED” tilePlace it in the scripts window.

From the green PEN menu lets grab the “CLEAR” tile to clear the screen.From the blue MOTION menu lets grab the “GO TO X: __ Y: __” tile. Set the X and Y values to 0 so that the button will move to the center of the screen.

We will also want to make sure that the button SPRITE starts in the “up” position.From the purple LOOKS menu, grab a purple SWITCH TO COSTUME <__> tile and place it at the bottom of our stack. From the dropdown menu choose “up”.

The first thing every “Don’t push the button” game says is “Don’t Push The Button!” and so we should add that here at the beginning of the game.Simply grab a purple “Say Hello” tile from the purple LOOKS menu and attach it to our blocks. Type to change the word “Hello” to “Don’t Push The Button!”.

FANTASTIC! We are on our way! Now lets create a stack of tiles for the button push.

When the button is pushed two things are true. 1. The user has moved the mouse pointer onto the button, 2. The mouse button was pushed.

Page 6:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

From the green OPERATORS menu grab the “<_> AND <_>” tile. Place it in the SCRIPTS work place (it wont stick to the stack just yet).

Now from the blue SENSING menu grab the “TOUCHING ___” tile and place it in the first hole of the green “<_>AND<_>” tile. Click on the drop down menu and choose “mouse pointer”.

Now grab the blue “MOUSE DOWN?” tile and place it in the second hole of the “<_>AND<_>” tile.

Voila! we can use this tile to signal a mouse click on the screen.

We need to have the computer be ready for a mouse click. We need to set it looking, constantly until a mouse click happens. For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over, forever if you will. The IF part will contain our conditions to go on. In this way the computer will stay alert – FOREVER – until the conditions named in the IF (our mouse click) come true.

Grab a yellow FOREVER IF tile from the yellow CONDITIONS menu. Put the green “<_> AND<_>” tile in the hole next to the IF condition.

Attach these tiles to bottom of the stack.

There are two things we want to happen when the button is clicked. We want it to change to the DOWN COSTUME for a short time, and we want it to say something new.

First grab the purple “SAY HELLO” tile from the purple LOOKS menu and place it in the FOREVER IF loop.

Page 7:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Now grab the purple “SWITCH COSTUME TO DOWN” tile and place it in the FOREVER IF loop as well.

Its time for a test. Hit the green flag and give your game a try. Nice so far!

BROADCASTING AND RECIEVING

The awesome part of a “Don’t Push The Button!” game is the give and take between the button pusher and the button. This interplay takes place in a number of acts. Each time the button is pushed a different dialog and/or effect takes place.

Lets call these frames of action “act 1”, “act 2” …

The different SPRITES in SCRATCH can communicate with each other by BROADCASTING events. When one SPRITE BROADCASTS an event, all the other SPRITES can listen and RECEIVE this event and react accordingly.

PROGRAM SECOND BUTTON PUSH

In the yellow CONTROL menu grab the yellow “WAIT 1 SEC” tile and place it next.

Page 8:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Now that this first button push even is finished we need the button to announce or BROADCAST that we are ready to go to the next event – act 2

Grab the yellow “BROADCAST ___” tile from the yellow CONTROL menu. Place it next in our stack. Under the pull down menu choose NEW and type in “act 2”.

Our button is sending out the message that it is time for a new set of tiles to take over the action. The job of this first stack of tiles is done. Lets put it to rest.

Grab a yellow STOP SCRIPT tile from the yellow CONTROL menu and put it next in the stack.

Awesome! The stack of tiles for the first act of our game is complete.

Next we will create that second stack of tiles for the second act of the game.

Grab the yellow, curved top tile “WHEN I RECEIVE ___” from the yellow CONTROL menu. In the drop down menu choose “act 2”.

Page 9:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Now we are ready to start another button pushing act. Since all the acts have the same basic elements, we can simply copy the tiles of the first act and drag them into the second act.

RIGHT CLICK on the purple SWITCH COSTUME TO <UP> tile in our SCRIPT and choose DUPLICATE.

A DUPLICATE set of tiles will pop up. Drag these tiles to the bottom of our SCRIPT and attach them to the purple SWITCH TO COSTUME tile.

Page 10:  · Web viewType to change the word “Hello” to “Don’t Push The Button ... For this we will use the FOREVER IF loop. The FOREVER part will keep checking over and over,

Now simply change the dialog of this act.

Type in “You again?” in the first purple SAY block of the act 2 script (where it did say “don’t push the button!”

Type “OUCH!” in the second SAY tile (where it did say “Hello!”)

Time for a test drive. Hit the green flag and give it a go!

EXPANDING THE GAME

Ok, its time for you to create your own Don’t Push The Button! game!

By repeating these simple steps you can create as many acts as you want. 1. Change the name in the yellow BROADCAST <__> tile to “act 3”, “act 4”… 2. Start a new stack of tiles with a new yellow WHEN I RECEIVE <__> tile. 3. Change the dialog within each stack. (the purple SAY tiles)4. Add action to different acts. Move the X:Y location of the button. Use the green STAMP tile to make fake copies of the button. Use the purple HIDE tile to make the button invisible!

Have fun, and remember, no matter what you do… DON’T PUSH THE BUTTON!!!

dr vic 3/10