Game Development Reference
In-Depth Information
The ways in which searching is implemented as a game mechanic are
as varied as game genre. In Doom, the player has to find colored keys
to unlock the same colored security doors; in Full Throttle , the player
must locate and use objects to help him in his quest to find a murderer
in a cross-country road trip; and in Manhunter: New York , the player is
entrusted with the task of hunting down resistance fighters. Searching can
be performed by moving the mouse around a scene to find and pick up
objects. This is the mechanism employed in the original Myst . It can also
involve moving the main character around a game level, such as looking for
medkits in Quake .
Unity Hands On
A HUD Radar for Searching
In this hands-on session we are going to create a game environment with
a number of items scattered over a large map that players must seek out.
To assist them on their quest, a heads-up display (HUD) radar system will
be deployed to give them some basic location details for the items.
Step 1. Download Chapter Four/RadarSearching.zip from the Web site.
Open the project with Unity. Open the hudRadar scene. This is the
finished project from the Chapter Three character animation workshop.
Step 2. Create a new JavaScript file named radar.js and add the code
given in Listing 4.26 .
Listing 4.26 Creating a HUD Radar to Track Game Objects
with the Tag orb
var orbspot : Texture;
var playerPos : Transform;
private var mapScale = 0.1;
private var radarSpotX: float;
private var radarSpotY: float;
private var radarWidth = 100;
private var radarHeight = 100;
function OnGUI ()
{
GUI.BeginGroup (Rect (10, Screen.height − radarHeight − 10,
radarWidth, radarHeight));
GUI.Box (Rect (0, 0, radarWidth, radarHeight), "Radar");
DrawSpotsForOrbs();
GUI.EndGroup();
}
function DrawRadarBlip(go, spotTexture)
{
var gameObjPos = go.transform.position;
Search Nedrilad ::




Custom Search