Disclaimer: All translations in this blog post are personal translators in their spare time and are copyrighted. Reprinted please indicate the source: http://www.wjfxgame.com, in addition to my csdn blog: http://blog.csdn.net/ml3947
Translator's note:
The company's current 3D project is changed from ogre 3D to unity3d. As the entire 3D project team is only familiar with unity3d, I have done all the preliminary research work. As of today, key technical issues such as unity3d dual-screen 3D mode, mouse control, mouse simulation, and opencv call have been solved perfectly, MD and Taipei held an emergency meeting and switched to unity3d. In addition, TM still applied for one month of study time-
-!! Let me train you on unity3d. However, unity3d is similar to many other technologies. It is easy to master and difficult to get started. Most people are just doing something simple and basic, fortunately, I can also improve myself through this precious period of time, so I don't have to keep busy at night. The game engine of javafx is slow, but in my plan, it is just a matter of time. It won't take a lot of time, because the prospect of javafx is not very clear, I am also waiting for the next major update of javafx.
A bunch of nonsense talk, as mentioned in the previous section, the common problem of writing blogs ....
In the previous section, we mainly introduced some of the free plug-ins and tools we need in game development, and how they initialize them. In this section, we will learn how to create a level and then complete the first level of our game.
The most important plug-ins we described in section 1 are orthello 2D. Orthello updated some cool new features in the new version. Make sure you are using 1.6a or an updated version.
Build settingsFile-> build setting, select webplayer (you can also use PC and Mac standalone if you like), and close the build setting window.
Player settingsEdit-> Project setting-> player, click resolution and presentation under per-platform settings, and change screen width to 800 and screen height to 600.
Render settingsSince we usually do not use the unity3d lighting system in 2D games, we must adjust the default environment light of unity3d to make the game scene brighter. The procedure is as follows: 1. Edit-> render settings...
2. Click ambient light and change its color to (255,255,255,255 ).
Orthello 2D initialization settings1. In the unity project view, go to orthello-> objects, and drag the OT object to the project scenario.
2. In the hierarchy view, click ot object to expand it, and then click View. Under view attributes, set pixel perfect resolution to 800x600.
3. Change custom size to 10.
Now, if you select main camera in hierarchy, you will see that its projection has been changed to orthographic and the size has been changed to 10. when you add an OT object to a scenario, orthello automatically changes its projection from perspective to orthographic. And when we change
The size of main camera is also changed when the Custom Size of orthello view is set.
After a series of experiments, I found that when the resolution and size of 800x600 are set to 10, A 1x1x1 cube occupies 30 pixels in the screen. This accurate pixel size makes it easier to create a grid when creating a level.
After completing the above steps, your project file should look like. Note: I have added a cube to the scene.Make the sprite atlas of the levelNow you know all the initialization settings. It is time to make everything more interesting. Our level pasters in This game mainly include the following simple parts: Bricks (which can be dug), concrete (which cannot be dug), ladders and ropes. Download the genie image and decompress it to any location. (Note: For details, see the bottom file, which contains the Genie ).
Open texturepacker and drag all the .png files from the sprites/leve and sprites/shoot folders to the sprites panel.Texture settings/LayoutSet algorithm to basic. deselect trim and enable auto alias.
Texture settings/OutputSet the data format to cocos2d. Under data file, click the "..." button to browse the directory where you want to store your genie (I put it in assets/spriteatlases of the project) and change the name to Level
Click Save to save. Texturepacker is automatically added. plist to data file, but unity needs the file to be. XML, so in the input box, we will. change plist. XML. now the texture file path should have been set to the same. the same XML Path. If you have already done the above steps, your texturepacker should look like: Now if you click Publish and return to unity, you can see a spriteatlases folder, sprite atlas and a data file are also included. We need to make some changes to sprite atlas in unity to make it look correct. 1. Select level.png in the project viewFilter ModeChangePoint.2. ClickOverride for Web, Set
FormatSetTruecolorThen clickApplyApplication.
Now it is time to use orthello to create a level Genie and then turn Atlas into a Sprite object.
The sprite container1. In the unity3d project view, expand the orthello Folder: orthello-> objects-> sprites-> spritealtas and dragSpriteAtlas-Cocos2DTo hierarchy. 2. In the hierarchy view, expand the OT object.ContainersThe object contains something similar to "container (ID =-684. This container will host all our level genie. We can rename it level. 3. Drag level.png from the spriteatlases folder"Otsprite Atlas Cocos 2D"The texture property in the script. 4. Drag level. XML from the spriteatlases folderAtlas data fileAttribute. NowAtlas dataProperty expansion, you can see all the graph blocks in the images packaged with texturepacker.
As shown in:
This chapter is a bit long. Because it is not too early now, I decided to divide it into two sections and continue to translate it tomorrow night. In fact, if you are interested in the translation, you can try again later.
Click the texture resource used in this section.
Reprinted please indicate the source: http://blog.csdn.net/ml3947