Flash Game Development Case series: Playing puppies

Source: Internet
Author: User
Tags definition final time limit

Game interface:

Figure 1

Game Overview:

In flash games, playing puppies (mice, etc.) is a relatively basic game. If you are interested in Flash game design friends, want to learn how to use Flash to make a game of friends, you can learn the production of this game well. Because the game is used in a number of basic, fundamental and commonly used ActionScript scripting language. In addition, we can learn from the Flash game planning, design to the completion of some concepts, methods and skills and other knowledge.

Game principle:

First of all, the game through StartDrag (), Mouse.hide () to change the hidden original mouse, the original mouse replaced by a kitchen knife, so cut up to be enjoyable: Using Math.ramdon () and mask technology allows puppies to randomly draw the current hole. The final score is displayed in an input text box, as shown in Figure 1.

Game Play Method:

The game is very simple to play, I believe most readers should know. is to move the mouse first to the puppy's head, and then the left mouse button, hit the puppy on the score, otherwise it is divided into 0. The significance of playing this game is to see who can in a certain time limit, get the most scores, to test who mind the most block, who operates the most flexible mouse.

Game definition:

Before you design a game, there are a number of questions to consider, the formation of the game environment, the creation of rules, and how to write the code for the game. But luckily, the game of playing the puppy (mouse, etc.) is not defined as complicated.

1. Game environment. The first thing to consider is what kind of environment the game is in. This is the key part of implementing a simple sequential game. In this game, a random way to let the puppy appear, which ensures that the game can play. For the game, the play is very important, there is no play game is not a player to play the second time.

2. Control method. How the player controls the role in the game, whether the operation is convenient or not determines the game's play. We can set up a lot of behavioral methods to control the movement of the protagonist of the game. In this game, the main is to allow the player to control the mouse freely.

3. The game is over. One of the hardest things in the game is to decide whether the game is over or not. When the game is running for a while, the game stops and displays the player's final score in the dynamic text.

Game production:

Open Flash MX, set the scene size to 400pxx360px, the background color is #006699, frame frequency is 15fps. In the game before the production, in order to let everyone have a sense of the whole, and in the future design to do know, so the author in the game design before making people see the main scene of the game between the middle and frame structure relationship. As shown in Figure 2.

Figure 2

Play Interface:

Figure 1

Game Overview:

In flash games, playing puppies (mice, etc.) is a relatively basic game. If you are interested in Flash game design friends, want to learn how to use Flash to make a game of friends, you can learn the production of this game well. Because the game is used in a number of basic, fundamental and commonly used ActionScript scripting language. In addition, we can learn from the Flash game planning, design to the completion of some concepts, methods and skills and other knowledge.

Game principle:

First of all, the game through StartDrag (), Mouse.hide () to change the hidden original mouse, the original mouse replaced by a kitchen knife, so cut up to be enjoyable: Using Math.ramdon () and mask technology allows puppies to randomly draw the current hole. The final score is displayed in an input text box, as shown in Figure 1.

Game Play Method:

The game is very simple to play, I believe most readers should know. is to move the mouse first to the puppy's head, and then the left mouse button, hit the puppy on the score, otherwise it is divided into 0. The significance of playing this game is to see who can in a certain time limit, get the most scores, to test who mind the most block, who operates the most flexible mouse.

Game definition:

Before you design a game, there are a number of questions to consider, the formation of the game environment, the creation of rules, and how to write the code for the game. But luckily, the game of playing the puppy (mouse, etc.) is not defined as complicated.

1. Game environment. The first thing to consider is what kind of environment the game is in. This is the key part of implementing a simple sequential game. In this game, a random way to let the puppy appear, which ensures that the game can play. For the game, the play is very important, there is no play game is not a player to play the second time.

2. Control method. How the player controls the role in the game, whether the operation is convenient or not determines the game's play. We can set up a lot of behavioral methods to control the movement of the protagonist of the game. In this game, the main is to allow the player to control the mouse freely.

3. The game is over. One of the hardest things in the game is to decide whether the game is over or not. When the game is running for a while, the game stops and displays the player's final score in the dynamic text.

Game production:

Open Flash MX, set the scene size to 400pxx360px, the background color is #006699, frame frequency is 15fps. In the game before the production, in order to let everyone have a sense of the whole, and in the future design to do know, so the author in the game design before making people see the main scene of the game between the middle and frame structure relationship. As shown in Figure 2.

Figure 2

Design components.

1. Design puppies. Press the shortcut key Ctrl+f8 Open the Create new symbol panel creates a new movie clip symbol called Puppy. You can then hand-draw or import an image of a puppy head, as shown in Figure 3.

Figure 3, Figure 4

2. Design black holes. The previous method creates a new movie clip symbol named "Hole." Then use the Ellipse tool in its scene to draw a black ellipse (no sideline), as shown in Figure 4.

3. Design a chopper. Create a new movie clip symbol named "Kitchen knife."

In the "Chopper" component to "Layer 1" renamed "Kitchen Knife" layer, see Figure 5 (Kitchen Knife readers can import). Click the 1th frame, press F9, and enter the following code in the Action panel that pops up:

Stop ();

Mouse.hide ();

Figure 5

Click the 2nd frame, press F6 key to insert keyframes, and then press the shortcut key Ctrl+t open the "deformation" panel so that the kitchen knife occurs 20 degrees rotation, see Figure 6.

Figure 6

4. Design puppy sport.

1. Press the shortcut key Ctrl+f8 create a new movie clip symbol called Puppy Sport, and then from the "puppy" component in the library to the "Puppy movement" component scene.

2. In the element "puppy movement" the scene chooses "Layer 1" 5th, 10, 20, 25 frames inserted into the keyframe, and then select Frame 10th, the "Puppy" object on this frame moved up about 50px, the right mouse button to select any frame between frames, choose the Create motion Tween command, Create a motion gradient animation, as shown in Figure 7. In the 20th to 25th frame also create a motion gradient animation, see Figure 7, just puppy movement is downward.

Figure 7

3. Create a new button symbol called "click". Press F6 key frame on the "click" Frame of the component, and then draw a rectangle with the rectangle tool as the control area for the Stealth button, as shown in Figure 8.

Figure 8

4. Create a new "Layer 2" in the "Puppy sport" component scene. At frame 5th of Layer 2, insert the keyframe, drag the click button symbol from the library to layer 2, and delete all frames from the 21st to 25th frame in the layer, as shown in Figure 9.

Figure 9

5. Create a new "Layer 3" to create blank keyframes on the 1th, 5, and 20 frames of the layer. Click the 1th frame, press F9 to open the Actions panel to enter the Code "Stop ();". Select Frame 5th and set the label name of the frame to up in the Properties panel, as shown in Figure 10. Also set the label name of frame 20th to down.

Figure 10

Design Scenario 1.

1. Back to Scenario 1, rename "Layer 1" to "background". Then drag the component hole from the library panel to the 1th level in scene 1, then copy 9 identical objects, press the shortcut key ctrl+k to open the alignment panel and 9 holes, as shown in Figure 11. Then use the Text tool to enter a "score" of two words (static text) at the bottom right of the scene.

Figure 11

2. Create a new "puppy" layer, drag the "Puppy movement" component from the library to the layer, and then copy the 9, as shown in Figure 12.

Figure 12

3. Create a new "mask" layer and draw a rectangle above the symbol "hole". Note that the rectangle should be larger than the "Puppy motion" component. Likewise copies 9. Right-click the layer and select mask Layer in the pop-up menu. As shown in Figure 13.

Figure 13

4. Click the first (upper left) "Puppy movement" component on the "puppy" layer to change its instance name to "Dog0" in the Properties panel, and then name the other puppy sport objects as DOG1, Dog2......dog8.

5. Create a new "script" layer, click the 1th frame, open the Actions panel, enter the Code "STOP ()". In frame 5th, insert the key frame and enter the following code:

Random (9) is a number from 0-9

gotoAndPlay ("Up") is to let the game jump to the up frame run, to achieve the puppy's random appearance

_root["Pig" add random (9)].gotoandplay ("Up");

6. Drag the "kitchen knife" component into the background layer, start the instance name knife in the Properties panel, insert the keyframe at frame 4th of the script layer, and enter the code:

Mouse.hide () hides the default mouse.

Mouse.hide ();

StartDrag ("Knife", true);

Design scoring System.

1. Enter the following code in frame 1th of the Scenario 1 "script" layer:

ROUND = 0;

SCORE = 0;

tatal = 0;

Stop ();

2. Click the 5th frame of the "tag" layer, define the label for the frame as again in the Properties panel, and then enter the code at frame 22nd in the script layer:

round++;

if (round%26lt;11) {

gotoAndPlay ("Again");

}

When the round is less than 11 o'clock the loop will continue. The way the game is scored is the faster you hit the puppy score. Create a new "score" layer in scene 1, insert a blank keyframe in frame 5th, and enter "point = 100;" Insert a blank keyframe in frame 20th and enter "point = 0;" As shown in Figure 14.

Figure 14

3. Create a new "score" layer in Scenario 1, drag a text box with the Text tool, and then set the text box to "dynamic text" in the properties panel, with the variable named score. As shown in Figure 15.

Figure 15

At Frame 22nd of the label layer, enter the following code:

Tatal = point;

Score = Tatal;

Where Tatal is the total score, Score = Tatal allows the text box to display the current player's score.

How did the game know if the player hit the puppy? Below we will add the "click" button component in the "Puppy sport" component. Then click the "Tap" button, press F9 to open the Actions panel, enter the code:

On (release) {

gotoAndPlay ("Down");

_root. Mouse.gotoandplay ("Up");

_root.gotoandplay ("End");

}

This code is when the button is clicked by the mouse, the movie jumps to the down frame to start playing, and scene 1 jumps to end frame playback.

Figure 16

Design Scenario 2.

In fact, Scenario 2 is easy to design, as shown in Figure 16. The code at Frame 25th is "gotoandplay (1);". Due to the length of the relationship, the scene 2 specific to the reader reference source document design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.