Demo Flash:
[Shielded Advertise] Download (1.48M, Zip Compression) Partial Work: The Sword Seal Demo Smoke Injection More ... Some of the street part
Figure (1) First introduce the part of the website 1. Background music player 2. Quick navigation 3. Content display Soul This 4. Update Diary MP3 Download Area My Music JE Room Email Friendship Link: 5. The protagonist and Some scattered small columns
The above is the basic components of the website street. Anyway, browsing the website is unattractive, if you can't find a good stuff, you will start to introduce the production process! The following code is some old way of writing, and some fat is good! The player has four parts, from left to right, "Play button", "Stop button" "Loads External SWF" (instance is called Player), "Menu button". Background music player put 5 songs
We can't put 5 songs in this street flash, because the Loading time of the website is too long, make this 5 songs into 5 SWF files, used to externally load the rightmost green of the player Up arrow, you can pop up songs. In fact, this arrow is a movie clip, an animation containing a button and a dish (Figure 2) Place a green button at the first frame, frame movement is stopped, write on the button Code ON (Release) {gotoandplay (5);} // When the button jumps to the 5th frame, the 5th frame is started to select the menu for background music, then you can load external music loading by selecting the song name button. External SWF code is: LoadMovie ("URL", Level / Target [, Variables])
(Figure 2) If you click on the leftmost play button, it will find any one of these 5 songs. So how is this implementation, in fact, just join the Random code on this button: On (Release) { AA = Random (5); if (aa == 0) {loadMovie ("comb.swf", _ root.player);} if (aa == 1) {loadingmovie ("babydance.swf", _ root.player); } if (aa == 2) {loadingmovie ("future.swf", _ root.player);} if (aa == 3) {loadingmovie ("I do love.swf", _ root.player);} if (AA == 4) {LoadMovie ("robot.swf", _ root.player);}} code interpretation is: When the button is pressed, the random integer between the setting variables AA is 0 ~ 5 if AA is equal to 0 The SWF file that loads the external name "COMB" to the film clip name "COMB" and played in the film clip name. One such pushing AA is equivalent to 1 when loading the second first ... .. About Random: Random (Value) Value an integer. Function; returns a random integer, this integer is between 0 and Value parameters. Click on the green square (stop button). The song will be stopped to join the code on the button: On (Release) {unloadMovie (_root.Player);} code is explained in: When the button is pressed, the SWF movie inside Player About UnloadMovie: unloadMovie [NUM] Level / Target ") Level loads the film level (_leveln). When you uninstall the movie from a level, in standard mode, the UnloadMovie action in the "Action" panel is switched to unloadMovienum; in expert mode, you must specify unloadMovienum, or select it from the "Action" toolbox. Target path of Target movie clip. Action; Remove a loaded movie or video clip from Flash Player. To uninstall a movie that has been loaded into the Flash Player level, use the Level parameter. To uninstall the loaded movie clip, use the Target parameter. The player section creates the production of the shortcut navigation strip, the entire shortcut navigation bar is a movie clip, then in the navigation strip movie clip, then divide the header to connect to the topic, the menu is made similar to the player above (Figure 3) ), There is no loss to segment on the time bar, and only need to modify the connection, you can make the display process you want, but don't forget the stop-stop action code street production is the street. It is also the link to all parts of the website, but all graphically, the control protagonist walks on the street, then click on the building to enter the page to connect, there is a little game nature. First, put the street, play your own imagination, and then put all the pre-painted buildings, it will become a street figure (4)
(Figure 4)
Then put the connection button on each symbolic building, for example, to make the house of the red roof into "JE's room", add a contact button at the door of the house, used to connect to "JE's room" this Page (Figure 5)
(Figure 5)
If you want to make a mailbox, add an invisible button on the screen of the mailbox, plus code: on (Release) {getURL ("mailto: zhaoyi19801@sina.com", "_self");} zhaoyi19801@sina.com It is my own email address, which can be changed. Other buildings can be connected according to their own preferences. In addition, there is a big avatar scene in the street (Figure 6) (Figure 6)
It is only necessary to establish a movie clip, put a instance name (CZSM) in the main scene, put the contents of the characters and the big avatar, separated, easy code control call (Figure 7)
(Figure 7) As shown in the figure and each person's dialogue, you can adjust the animation of each person's dialogue by clicking on the button on the person, such as the MC LJ conversation on the street, first in the LJ body. Adding code called the secondary animation (Figure 8): On (Release) {with (_root.czsm) {gotoandplay (50);}} code explanation: When the button is pressed, the specified instance is called "CZSM" (Previously displayed Movie clip of each person's dialogue) Jump to the 50th frame and runs, the 50th frame is an animation with the MC-LJ conversation (Figure 9), which realizes the different screens with each person's conversation. Effect (Figure 10).
(Figure 8)
(Figure 9)
On this button, add code 50th frame as the content of the MC-LJ conversation
(Figure 10) Click on MC-LJ to appear with the scene of the LJ conversation during the day and night to make a careful person, when browsing the website during the day, the picture will be different (Figure 11) (Figure 12) When I entered the website during the day, the sky was blue, and I also heard the voice of the car. I hang up the moon one to the sky. It is very quiet. Some things can only look at night. This method is How to achieve it?
(Figure 11)
(Figure 12)
In fact, this method is to use the Date object to read the video time of the browser. According to the system time, it is decided to display the day or night to take the background blue sky and the moonlight. Before making the background, the background is a movie clip. There are two frames, the first frame is image of the day (the blue sky), the second frame is the image of the night (moon night). After doing well, just add the following code above the movie clip: OnClipEvent (loading) {sundate = new date (); sunhour = sundate.getHours (); if (Sunhour <6 or sunhour> 18) {gotoAndStop (2) } else {gotoAndStop (1);}} code explanation: First create a time object (Date) object, used to read the browser's system time, if the time is between 6 o'clock and 18 o'clock, it is in the day The time, the movie clip jumps to the frame with the daylight and stops. Otherwise (ELSE) jumps and stops in the night with the night picture. This picture is not very simple to achieve the above effect. Use this code to achieve a lot of effects, such as the above picture, there is no thing on the wall during the day, and the wall is MC-JE, one to night browsing. There will be a blue silly cat on the wall, and the person under the wall is replaced by Arab, making methods: put MC-JE and Arabs into a movie clip 1st to 20 frame MC-JE 25 to 65 frames are Arabs and cats (Figure 13) (Figure 13)
Then add the above code on this movie clip, it achieves the effect. Pointing a stupid cat game in fact, in fact, the cat appeared on the wall is a small game, when it is clicked in the cat, it will be jumped to the air, if it is not able to click it again, it will be two The paragraph jumps, the count will appear below it, see who the number of clicks, if the cat is landing, the count will return, let's talk about this small game specific production method: 1. First put the cat first It is a movie clip, 1 to 20 frames painted cat walking screen, then set a variable hit = 0 in the first frame (Figure 14), 25 to 33 frame painting cat jumped (Figure 15), 35 to 43 frames Made a picture of the cat's second jumped (Figure 16)
(Figure 14) (Figure 15) (Fig. 16)
2. The game is mainly implemented by pressing the cattle and then begins to make a button. The first step adds an invisible button in that section of the cat walk (Figure 17). Add Action Code: On (Release) {gotoandplay (25);} Code Interpretation: When you press this button, jump to the 25th frame and run (the 25th frame is the first picture of the cat, " The button will jump up)
(Figure 17) (Fig. 18) (Fig. 19)
The second step is to realize the two-stage jump of the cat, in that part of the cat, add such a stealth button (Figure 18), and join the action code: on (press) {gotoandplay (35); hit = Hit 1 } Code Interpretation: When the button is pressed, go to the 35th frame and run, (35 frames is the picture of the cat two-segment jump), the variable Hit increases 1 (in fact, the number of combo 1) The third step is to be implemented Two-segment jumping cats perform a count display, first to draw a text box, then set to dynamic text, then set the variable output to the text box as HIT (Figure 20), this text will display the variable HIT The value is. (Figure 20)
This kind of this, this game is finished with a small game. When the protagonist is controlled by the website, the viewer wants to click the mouse control protagonist to implement the links of each part. Let's talk about how to implement the protagonist movement after the mouse. First, you must first arrange the internal structure of the protagonist movie editing: the first frame of the protagonist stands (Figure 21) The picture fifth to 15th frame protagonist moves (Figure 22) Episode 25 to 34 Frame Run The screen (Figure 23) The internal structure of the protagonist is arranged to do the code part to set a few initial variables before writing code, add: OnClipEvent (loading) {// Mobile speed_ ROOT: SPEED = 5; // Online _root: yys = 290; // Next border _root: yyy = 335; // Left border _root: xxs = 80; // Right border _root: xxx = 450; } Code Interpretation: The speed of the movement is 5, the movement range of the protagonist, the upper boundary is 290, the lower boundary is 335, the left boundary is 80, the right border is 450
(Fig. 21) (Fig. 22) (Fig. 23)
Continue to add code: OnClipEvent (mousedown) {xx = _root: _xmouse; yy = _root: _ymouse; if (mouse.doubleclick ()) {gotoandplay (25);} else {gotoandplay (5);}} code explanation: When the mouse Press. Set the value of the variable XX is the value of the X-axis of the current mouse, setting the value of the variable YY is the value of the current mouse y axis (in fact, when the mouse is pressed, lock the coordinate of the current mouse when the mouse is pressed). If the mouse double-clicks, the movie clip jumps to the 25th frame and runs (with the frame of running action), otherwise jumps to the 5th frame and runs (with the frame of walking) About the mouse Double-click the event mouse.doubleClick ) There is a detailed description of "Some of My Music Production". OnClipevent (MouseDown) {_root: f = 1; setProperty (this, _xscale, 45);} else {_root: f = 2; setProperty (this, _xscale, -45);}} code explanation : This code is the left and right opposite to the control protagonist. If the mouse is pressed, the X-axis position (variable xx) is greater than this movie clip (protagonist), set the main angle to the right to another. Set a variable _root.f is 1, otherwise set the variable _root.f to 2, set the protracant to the left, in the future judgment, if _root.f is equal to 1, indicate the main angle to the right, _root. f is equal to 2, indicating that the protagonist is left. The script code on the protagonist film clip is written, then double-click the internal script of the editing movie clip first to write the code of the walking section: if (_x <_root: xxx) {if (_xSetProperty (this, _x, getproperty (this, _x) _root: speed);
}
}
IF (_x> _root: xxs) {
IF (_x> xx) {
SetProperty (this, _x, getproperty (this, _x) -_ root: speed);
}
}
IF (_y> _root: yys) {
IF (_y> yy) {
SetProperty (this, _y, getproperty (this, _y) -_ root: Speed / 2);
}
}
IF (_y <_root: yyy) {
IF (_y
SetProperty (this, _y, getproperty (this, _y) _ root: Speed / 2);
}
}
Code Interpretation: When the X-axis of the protagonist is within the right boundary (_root.xx), enter the brace and continue executing the program. When the X-axis of the protagonist is less than the X coordinate of the mouse, the protagonist film is added (moving right) _root .speed value, (_ root.speed is 5)
When the X-axis of the protagonist is within the left boundary (_root.xXs), enter the braces to continue executing the program. When the X-axis of the protagonist is greater than the X coordinate of the mouse, the protagonist movie is subtracted (left moving left) _Root.Speed Value.
When the Y-axis of the protagonist is within the lower boundary, enter the rigidity to continue executing the program. When the Y-axis of the protagonist is greater than the y coordinates of the mouse, the movie of the protagonist is subtracted (upward) _root.Speed (_Root.Speed) / 2=2.5) When the Y axis of the protagonist is within the upper boundary, enter the corner to continue the execution program. When the Y-axis of the protagonist is smaller than the Mouse Y coordinate, the protagonist film is added (down) _root.speed Half of half (_ROOT.SPEED / 2 = 2.5)
After writing the code, insert the above, insert the end portion (Fig. 24).
(Figure 24) (Fig. 25)
Next, write the code of the running part: if (_x <_root: xxx) {= (_x
SetProperty (this, _x, getproperty (this, _x) _ root: speted * 1.5);
}
}
IF (_x> _root: xxs) {
IF (_x> xx) {
SetProperty (this, _x, getproperty (this, _x) -_ root: speted * 1.5);
}
}
IF (_y> _root: yys) {
IF (_y> yy) {
SetProperty (this, _y, getproperty (this, _y) -_ root: Speed / 2);
}
}
IF (_y <_root: yyy) {
IF (_y
SetProperty (this, _y, getproperty (this, _y) _ root: Speed / 2);
}
}
This code is basically the same, but it is just that the speed of walking is accelerated, (_root.speed * 1.5), multiply the walking speed 1.5, is running at the speed of 1.5 times, if These parameters can be modified if the speed to run is faster.
Plus the code after the code is inserted into the frame of the running portion (Fig. 25).
Ok, the control of this protagonist is all written, try the effect is not bad!
Making of the street reel when the protagonist
When the protagonist travels, when the protagonist goes to the home side or the leftmost, the street will move with the movement of the protagonist, and the steps to make a street scroll will be introduced.
First, put all things on the street into a movie clip, become a street, then give the street, a instance name "street", and do two invisible video clips to make collision detection, one is placed The scene is the left side, one is placed on the right, and the instance is named "R", "L" (Figure 26)