"Dumb Wood Unity" introductory tour 006:demo to Death (a) _ Scene and protagonist

Source: Internet
Author: User

Finally put some basic things introduced, I do not want to introduce the boring menu and shortcut keys, these things everyone in the process of tossing slowly familiar with good. What do not understand to ask degrees Niang, do not like degrees Niang, can find Google.

This time, we start a very simple demo, I suddenly think of a game, or can only be called demo. A character, you can walk around, the map has a lot of dark thunder, stepping on it will randomly produce some effects (such as blood, blood loss, increase defense, small if the ability to lose the groove, etc.).

The characters have to have some UI that will move along with the characters.

Although it is a small demo, the various actions required for getting started should involve, including: moving characters (without animations),Trigger, UI, and code to create and modify objects. OK, let's get started.(Jor: Wait, what is the ability to lose a slot?) )

Stupid wood to contribute, what? Player? No, it's the heart.

Reprint please specify, original address: http://www.benmutou.com/archives/2110

Article Source: Dumb Wood and game development

1. Scene, camera positioning first create a project, I named "unity_benmutou_006", you are casual. Then create a scene: "Hierarchy", "right Button", "3D Object", "Terrain"

The terrain size is set to "200X200" on it, if you forget how to create the terrain, how to set the size of the terrain, please review this tutorial: http://www.benmutou.com/archives/2063Remember the shortcut keys we used to "QWERT"? I don't want to repeat what I just said.

Now play all your abilities and move the new scene to the middle of the editor, for example: Try running the game now, can you see our scene?(Jor: I feel like I've seen your sister.)Yes, we can not see the scene, but also can't use foul language scold me ...

Important operation came to let the scene appear in theWebcamMiddle: Click to select the "Main Camera" object (in the Hierarchy window), click the Menu "Gameobject", then "Align with View" and run the game again to see our scene.

This function is used to put objectspositioningTo the current view location, so, with the camera selected and then positioned, the camera will run to the currentEditorThe place to see. As a result, the scene can appear inCameraIn the range, and the camera decided that we were runningGameWhen you can see things, you run the game to see the scene. The explanations here may not be accurate, but the current understanding is very handsome.(Jor: I feel that it is absolutely not related to handsome)

OK, press thekeyboardCtrl+s, save the scene, save to the project's assets directory, namedGame。

2. "People" then of course is to create our protagonist, we do not use cube this time, we change a handsome. Right-click on "Hierarchy", then click "3D Object", then "cube", so we create a cube, it will be our character.(Jor: It is really handsome a lot ... Ah, what a fart! Or cube, are you going to die? To die? )

At this point, double-clicking the cube will find that cube is not in the scene, but is alone in a corner. It doesn't matter, we put it in the scene, because the operation is more cumbersome, so I use a GIF to show: First, the cube moved to the scene (Terrian), and then the cube position (Transform) reset, so that cube will appear in the corner of the scene.(Jor: Still a corner!) )Although still the corner, but at least is the corner of the scene, not the corner of the world.

OK, now, double-click Cube, find it, and then move the cube to the appropriate location of the scene, such as: Because the scene is relatively large, cube is small, we may not see where it is ...(Jor: I know, we are blind)

We can enlarge the cube a bit, there is a scale attribute in the transform attribute, it is obvious that x, y what set to 5 bar.(z: Obviously only X, Y, Z, can't you say it all at once?) Why do you have to ignore me! Is it a total of three letters? Is it hard to write it all out? Is it hard to do!? )

OK, the characters are done.

No, wait, by the way, rename the cube, select Cube on hierarchy, and then press F2 to rename it. It's called ... "Bugplayer"right." (Jor: Can be a bit more casual no)

3. Create protagonist script since it is the protagonist, it is certainly possible toplayerTo control, to control our cube, no, now called Bugplayer. Want to controlBugplayer, there will be a script to handle these logic.  then, right-click on "Create", "C # script" on the "Project" window, then name the script "Bugplayerlogic". Finally, drag the script to Bugplayer body, how to drag? If you forget, please guess yourself (Jor: Guess you mei) or look back at the tutorials I wrote earlier.  Well, let's just tell you secretly:
Because it is the demo, I do not consider the layout of the catalogue, all squeezed together just fine.

Next, to open the new script file, there are two ways to open it:A. Directly under the Project window, double-click script File B. In the Bugplayer property, double-click the small icon to the left of the script:

If you have listened to me, installed VS2015 (Community edition, is free), then it will automatically start vs, open the current Unity projectSolution Solutions, and open the script file that you double-clicked. When you open it, you will see that there is only one start and update function in it.

4. Ok, next we'll do it again, what do we do next? I think about it.(Jor: You are not the first to think well before you write the tutorial?! )Let's get the Bugplayer to move up.
This article source: unity_benmutou_006.7z

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Dumb Wood Unity" introductory tour 006:demo to Death (a) _ Scene and protagonist

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.