Tutorial_Academic_Racing_Game

MMF Tutorial: Academic Racing Game
This tutorial will walk you through the steps of creating your own Academic Racing Game using
Multimedia Fusion 2. In this game, one to two students race around the screen trying to be the
quickest to snatch up the right answer to various questions.
Application Setup
1. Start up Multimedia Fusion and click “File, New” to get a new blank application.
2. Click once on the thumbnail of level one in the Storyboard Editor:
3. Upon clicking the thumbnail, you’ll see the properties of Frame 1 appear in the Properties
Toolbar.
4. Change the application size to 1024 x 768 so that we can fit more items on the screen.
5. We also have to change the window size to 1024 x 768. To do so, click on “Application 1”
in the Workspace Toolbar. Then click on the window icon in the Properties Toolbar and
change the window size to 1024 x 768.
6. Next click the Runtime Options button
and make sure “Machine-independent
speed is selected. This option makes it so
that no matter what the processor speed
1
of a particular computer is, the game will run at the same speed. This is especially
important in games.
7. Now double-click on the thumbnail of level one in the Storyboard Editor, which
will get you into the Frame Editor, and we’re ready to start building the game.
Creating the Visuals
8. The first thing we’re going to do here is create a title screen. Let’s change the
background color to something other than white. Click on “Frame 1” in the Workspace
Toolbar. The settings for Frame 1 should appear in the Properties Toolbar at the left.
Click on the right of where it says “Background color,” and choose a different color for the
frame.
9. Now insert a string to serve as the title of the game. I would name it something like
“Math Race,” “Science Race,” etc. I recommend that you choose a common font style,
and that you increase the font size so it’s more visible.
10. Next, insert two buttons. Change the text on one so it says “Begin” or “Start,” etc. The
other should say “Quit,” etc.
11. Feel free to embellish this screen with a border, images, or background music, but really
this is all we need on the title screen.
12. Next we’ll create Level One of our game. Go up to the Navigate Toolbar and click the
Storyboard Editor button,
then click the number 2 next
to the word “More.”
Doing so will create
another screen for us to
build Level 1 with.
13. Now double click on the
miniature Frame 2 screen and we’ll be in the Frame Editor and ready to create the
visuals for Level 1.
14. I recommend that you change the background color of this frame just as you did with the
title screen (see #8).
15. Look down in the lower left-hand corner and you should see the Library Toolbar. Browse
through it until you find the “Games” section. Then look in the “Spacecraft.” Choose two
different spacecraft and drag them into the frame. I recommend that you choose
spacecraft that are in the top-down view.
16. Now we need to tell MMF how to handle the movement of those two spacecraft. Click
on the one you want controlled by player 1. Now click on the Movement button in the
Properties Toolbar.
Change the movement type to “Eight Directions.”
Notice that it is already set to be controlled by
player 1.
17. Now do the same thing for the other spacecraft,
but this time, change the player to Player 2.
18. The next step is to define what the controls will
be for each player. Click on “Application 1” in the Workspace Toolbar, then click on the
Runtime Options button in the Properties Toolbar. Next to “Default Controls” click “Edit.”
2
Click the “X” that represents Player 1 and change the Player 1 controls if you’d like to do
so. Then make sure Player 2 has controls that are different than Player 1.
19. Next we’ll add items that the two spaceships will race to get. Browse through the Library
Toolbar until you find images that relate to your content area. If you can’t find any in the
MMF library, you may have to create your own images or use text instead of images (just
make sure the texts are Active Objects). Insert several different items. As an example,
I’m going to make a game that will test my students’ knowledge of the fruits in Spanish.
So I’ve added several fruits to my Level 1 screen. Here’s what it looks like so far:
20. Eventually we’ll want random questions to appear at the top of the screen. In MMF, if
you want to randomize you need a counter. So, insert a counter and place it off screen.
Because it’s off screen, it is part of the program, but it won’t be visible to the players.
21. We also need alterable text at the top of the screen, so insert a string and center it near
the top of Frame 2. You may want to change the font size, type, alignment, etc.
3
22. Now, make sure the string is selected, go over to the Properties Toolbar, click on “Text,”
and change it to whatever you want your first question to be. I want mine to be
“Manzana.” When the players see “Manzana” appear, they’ll go after the picture of the
apple.
23. Next, click the “New” button to add more paragraphs. Enter a new paragraph for each
item you placed on the screen, then type your question that goes with each item.
24. The final visual aspect we need to add is a scoring counter for each player. Insert a
Score object for both players and place them in a logical spot on the screen. When you
insert the Score object for Player 2, you will have to go into the Settings in the Properties
Toolbar and change the Player setting for that Score object to Player 2.
25. We’re done with the visuals!
Adding the Code
26. Now it’s time to code our game so it actually works. Go to the Storyboard Editor by
clicking its button on the Navigate Toolbar.
27. First we’ll make the buttons on the title screen work. Click on the thumbnail of Frame 1.
Then click the Event Editor button on the Navigate Toolbar.
28. Right click on “New condition,” right click on the first button,
and choose “Button clicked?”
29. Next, right click under the Storyboard Controls icon and
select “Next frame.”
30. Repeat steps 24-25 for the second button, but this time
instead of “Next frame” choose “End the application.”
4
31. That’s it for Frame 1!
32. Now go to the Event Editor for Frame 2. (Use the
Workspace Toolbar and the Navigate Toolbar.)
33. So now we have a working title screen. Next we need to
make it so that random questions (the answers to those questions are the images or text
that you have placed on the screen) appear at the top of the screen. After that we’ll
make it so the two players can “collect” the right answers to the questions by bumping
into them.
34. Let’s set up the random counter. Right click on “New condition,” right click on the
Special icon, and select “Always.”
35. Now right click in the square beneath the counter icon (make sure it’s the counter and
not the score icons). Select “Set Counter,” and then type the following:
random(NUMBER)+1
Where it says “NUMBER,” type the total number of different objects you placed on the
screen in Frame 2 (for example, I put 13 different fruits in mine, so I enter the number
13). Click “OK.”
36. Right click on “New condition,” right click on the Counter icon, choose “Compare the
counter to a value,” type the number 1, and click “OK.” Next, right click under the Special
icon, select “Change a global value,” and “Set,” type the number 1, and click “OK.”
37. Next, right click where this event row intersects with the String column, choose “Set
paragraph,” then choose your first answer (Paragraph 1).
38. Now we need to add another condition to the same event. To do that, right click on the
event number (It’s probably a 2). Choose “Add a new condition,” right click on the
Special icon, choose “Compare to a global value,” and click “OK.”
What we’ve done here is said, “If the random counter is equal to 1, and Global Value A is
equal to 0 (which it will be at the start of the level), then make the String object show
paragraph 1 and change Global Value A to 1.” This makes it so that if the random
counter equals 1, paragraph 1 will be visible until we decide to make it invisible.
39. Before we move on, we have to add yet another condition to this same event. We must
make sure that the question is only asked if the answer is still available.
5
So, right click yet again on the same event number, choose “Add a new condition,” right
click on the object that is the answer to question 1 (Paragraph 1), choose “Pick or count,”
choose “Compare to the number of ________ objects,” change the dropdown list from
“Equal” to “Greater,” then click “OK.”
40. Now just repeat steps 36-39, but this time we want to say “If the random counter is
equal to 2, and Global Value A is equal to 0, and the number of [answer 2] objects is
greater than 0, then make the String object show paragraph 2 and change Global Value
A to 2.”
41. Continue to repeat those steps until each paragraph that you entered has a random
chance at being displayed. Remember that there are shortcuts to creating similar (but
different) events and conditions.
42. Right click on “New condition,” right click on the ship that will be controlled by player 1,
choose “Collisions,” choose “Another object,” then select the object that corresponds to
your Paragraph 1 text. For example, my Paragraph 1 text is “Manzana,” meaning
“Apple,” so I’m selecting the apple object.
What we’re doing here is testing for a collision between player one’s ship and the apple.
If that happens AND the text “Manzana” is showing, then we’ll want to reward player one.
6
So, we need to add another condition to that same event we just created—a condition
that will test if the text “Manzana” is showing.
43. Right click on the number of the event you just created, choose “Add a new condition,”
right click on the Special icon, choose “Compare to a global value,” type the number 1,
and click “OK.”
Here’s where you have to decide what you want to have happen when player 1 runs into
the right answer. There are several things you could have happen, but I think I’ll stick
with the following: add one point to the player’s score, make the object disappear, play a
sound effect, and change Global Value A back to 0 so that another random question can
be asked.
44. On that same event row, right click under the Player 1 icon (It has to be the Player 1
icon, NOT the spaceship controlled by player 1), choose “Score,” choose “Add to score,”
type the number 1, and click “OK.”
On that same event row, right click under the object that should disappear after being hit
by player 1, choose “Destroy.”
On that same event row, right click under the Sound icon, choose “Samples,” choose
“Play a sample,” browse through the files for a sound effect that would be appropriate,
and click “OK.”
On that same event row, right click under the Special icon, choose “Change a global
value,” choose “Set,” and click “OK.” That will reset the Global Value A back to 0.
45. Now create a new event row that’s identical to the previous one, with only these
exceptions: change the spaceship icon from player 1’s ship to player 2’s, and make sure
1 point is added to player 2’s score, not player 1’s.
46. Repeat steps 42-45 for each item that the players can collide with to earn points. Make
sure you’re always aware of who is doing the colliding, what object should be destroyed,
who should earn the points, and make sure that the “Global Value A=____” has the right
value in the blank. It should match up with the object that was collided with.
47. Once you’ve done step 46, you’re basically done. If you have the paid version of
Multimedia Fusion 2 (or if you’re in the U.E.N. lab), you can “build” the game so that it will
run on any modern Windows computer. Just go up to the upper-left hand corner of the
screen, click File, then Build, then Application, choose where to build it, then click “Save.”
48. If you want to embellish your game a bit, you could add some of the following:
a. Make it so players bounce off wrong answers and/or each other.
b. Penalize players for bumping into wrong answers.
c. Either: Force the players to stay on screen OR when they leave the screen on
one side they wrap around to the other.
d. Add more levels and/or a game over screen that celebrates the winner.
7