Game Development Reference
In-Depth Information
The first thing you will notice is that the Scene Gizmo is gone. You are prevented from inadvertently
rotating the view out of whack. A little investigation will show that you are looking at an ortho Back
view of the 3D scene.
2.
Drag each of the battery sprites from the Project view into the upper left of the
Scene view.
3.
Focus the view on them.
At close proximity, you can see the selected sprite will have blue dots at the corners and a blue
ring at the pivot point (in this case, the Bottom). You will notice that you no longer have a transform
gizmo in 2D display. With the new gizmo, the rectangle with blue dots, you can perform all of the 2D
transforms as well as constraints.
4.
Place the cursor inside the rectangle, and drag to move the sprite around in
the 2D space.
You can constrain the movement to the closest direction by holding the Shift key down while dragging.
5.
To scale, place the cursor over a side or corner and click and drag.
6.
To rotate, move the cursor just outside of the gizmo until the icon changes to
indicate rotation (similar to Photoshop rotation).
Note that the scale changes in the Inspector and that it is a uniform scale.
7.
Move the white sprite over the outline sprite.
To control the layering of this simple combination, you can use the Z depth.
8.
Select Battery_0, the energy bar, and adjust the Z Position from the Inspector
until it is behind the outline sprite.
9.
In the Inspector, drag its Y Scale up and down for a preview of how you will
match it to the remaining battery life percent.
Because you set the Pivot of the sprites to Bottom, you will be able to set the scale correctly.
10.
In the sprite's Sprite Renderer component, change the Color to a nice green
(Figure 9-16 ).
Figure 9-16. The energy bar on top of the outline (left), behind the outline (center), and scaled and colored (right)
 
Search WWH ::




Custom Search