Disclaimer: the translation categories of this blog post are personal translations, All rights reserved. For more information, see http://blog.csdn.net/ml3947. for more information, visit http://www.wjfxgame.com.
This section is followed by the previous section.
Create an animated brick
This Brick needs some animation effects when it is destroyed. So we need to make an animation.
1. Drag an animation from orthello> objects> sprites to the hierarchy view. This will add an object named "animation (ID =-4320)" under ot-> animations. Rename it "level anims ".
2. Select the newly added otanimation and set the attributes as per.
3. Set the size to 3 under framesets.
4. Drag level from ot-> containers to the container attribute under otanimation.
5. Find the animatingsprite in orthello-> objects-> sprites and drag it to the hierarchy view. This should add an object similar to "animating sprite (ID =-23050)" in the scene. Rename it to "brick ".
6. Select the newly added animating Sprite and drag the previously created "level anims" to its animation attribute. After dragging, the property sprite container should be automatically filled with "level" container. If not, you can manually drag the sprite iner of "level.
Now, after clicking play, you should be able to see bricks in the scene. It will execute all frames in the animation. If you do not want it to be executed at the beginning of the game, deselect play on start.
Note: if you cannot see bricks in the game view, make sure you have set the scale of bricks to 1, 1, and 1 (sometimes when we create an orthello object, its X and Y scales may become very small ).
Run:
Add collision to bricks
We need to add collision bodies to the bricks so that our roles can stand on them.
1. In the hierarchy view, select "brick" and select "colretriable. This will automatically add a box collider and Rigidbody component on Sprite.
2. We also need to add a specific tag for the object. In edit-> Project Settings-> tags, add "Ground" ladder "and" rope.
3. Similarly, we add two layers "Ground" and "ladder" in layers ".
4. Select "brick" and change its tag and layer to "ground ".
My csdn blog address: http://blog.csdn.net/ml3947,my personal blog address: http://www.wjfxgame.com. Someone has no idea about copying without copyright. Insert personal information in the middle.
Create it as prefab
All reused objects are used as prefab for performance consideration. No translation here.
Create static level genie
Next, we will make concrete, ladders and ropes genie. We will use the same iner, but because they do not need an animation, we will use sprite to replace the animation Sprite. Because the above process already exists, I Will abbreviated it here.
1. Make concrete brick genie.
Drag the sprite from orthello-> objects-> sprites to hierarchy. This will create a Sprite in the scenario. Rename it as "concrete ". Then, drag the level object from ot-> containers to the sprite container attribute of the sprite. Currently, we can see the genie, but we can see bricks. On the right side of the "frame Index", hold down the mouse and drag it to adjust the attribute. We can see that when the frame index is 14, it looks like a filled concrete brick. (This index can also be seen in your Sprite Atlas ).
Select the colretriable check box. Added a collision to the object.
Similarly, select the tag and layer as the ground.
Finally, a prefab will be created and dragged up. Make a prefab of a concrete brick.
2. Create a ladder and rope genie.
The steps are the same as above, but the frame index of the ladder is 15. The frame index of the rope is 17. Create the corresponding Prefab.
Create a baffle plate at the bottom
Now, we have all the level creation genie. However, we also need to lay a baffle plate at the bottom of the level, in order to avoid the loss of our role in the bottom.
This bezel is used to create a cube and rename it "border bottom" to the appropriate position on the screen. (In the lower part of the game scenario, you can create a game first, and then release it after the game level is created ). To make the bezel cube look similar to the game style, you can create a meterial material for the cube and change its color to a color close to our bricks.
Change Background Color
When we are about to start creating the level, we should first change the background color to black. Select Main camera and change the background color to 0, 0, 0,255. You should be able to see that the background of the game window turns black.
Create a level
Now all preparations have been completed. Let's create a level.
You just need to drag the bricks, Concrete bricks, ladders, and ropes we made above to the scene, copy, paste, and adjust the position. Until it is made into a game scenario.
You can complete a scenario similar to the following. Remember, using Vertex snap makes it easier to adjust the position of a brick.
It has become interesting. This section describes how to use animations and genie in orthello.
In the next section, we will add our roles to make our games really dynamic.
Download resource files. See the last part of the previous section. Yes.
Reprinted please indicate the source: http://blog.csdn.net/ml3947