| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Pac Man Game - Tutorial 3 - Adding Food - Hiding Sprites

Page history last edited by Steve Sweeney 9 years, 7 months ago

Pac Man Game - Tutorial 3 - Eat Food - Hide Food - Keep Score

Step 1:  Create the food!

1. Select a New Sprite from file.  I used a tennis ball, but you can select or draw anything.

step4a

2. Use the "shrink sprite tool" to make the food smaller in relation to the rest of the world.

step4c
step4d

3. Rename the sprite.  (I chose "Ball.")

step4b



Step 2:  Create the scripts for score and hiding.

1. Click on "Variables" and "Make a Variable" and name it "Score."  Click "Ok."

step4e

2. Drag a "When Green Flag Clicked" and a "Forever If" into the Ball's scripts field.

step4f

3. Add the following scripts:
a. Set "Score to 0" between the Green Flag and the Forever if.
b. "Change Score by 1" inside the "forever if."
c. Blue Hexagon "touching 'Eater'" inside the forever if.

step4g

4. Add a "show" and "hide" to the script.  Put the "show" underneath the "when Green Flag Clicked" and the "hide" inside the forever script.

step4h

5. Check your program.  Click the green flag and run your Eater over the food.  It should hide and change your score by 1.  Click the Green Flag again, the score should set to zero and the food should show again.

Step 3:  Add a Sound when the Eater touches the ball.

1. Make sure you are on the Eater sprite.  Click the "Sounds" tab.

step5a

2. Select "Import Sound" and select a sound from the folder list.

step5b1

step5b

step5c

3. You can test your sound by clicking the blue play triangle under the sound name.

step5d

4. Click on the Scripts Tab. Drag a purple "play sound and wait" block into the Ball's script.

step5e

5. Click the Green Flag and test your program.  When the Eater touches the Ball you should hear a sound and the score should increase by 1.

Step 4: Copy objects.

1. Once you are satisfied with the Ball sprite and its scripts, click the "Stamp" tool and then click on the sprite you wish to copy.  Use the "Stamp" tool to copy your Ball sprite.  

step6a

2. Copy and arrange the ball sprites around the maze.

step6b

Comments (0)

You don't have permission to comment on this page.