Game Development Reference
In-Depth Information
private var r_statTextureEquip : Rect = new Rect (252, 81, 331,
142);
private var r_skillBoxEquip : Rect = new Rect (460, 121, 127,
125);
//The position of each equip button from 0 - weapon, 1 - armor, 2
- accessory, 3 - skill
private var r_equipRect : Rect[] = [new Rect (252, 101, 180, 40),
new Rect (252, 161, 180, 40), new Rect (252, 221, 180, 40), new
Rect (464, 125, 119, 117)];
private var r_equipWindow : Rect = new Rect (500, 0, 70, 100);
private var scrollPosition3 : Vector2 = Vector2.zero;
private var scrollPosition4 : Vector2 = Vector2.zero;
private var scrollPosition5 : Vector2 = Vector2.zero;
private var scrollPosition6 : Vector2 = Vector2.zero;
private var a_equipBoolean : boolean[] = new boolean[4];
private var in_toolWeapons : int = 0;
private var in_toolArmors : int = 0;
private var in_toolAccess : int = 0;
private var in_toolskill : int = 0;
2. Then, go to the Start() funcion and add the following code at the end:
//Setup boolean equip
for (var i : int = 0 ; i < a_equipBoolean.length; i++) {
a_equipBoolean[i] = false;
}
3. We go to DoMyWindow (windowID : int) and uncomment the highlighted line
as follows:
case 2 : //Equip
//Create an equipment tab
EquipWindow();
break;
4. Next, we are going to create an EquipWindow() funcion, which will control our
equipment tab:
private function EquipWindow() : void {
GUI.Box (r_equipBox, "");
GUI.Box (r_equipWeaponBox, "");
GUI.DrawTexture(r_statTextureEquip, t_statusBox2);
GUI.DrawTexture(r_skillBoxEquip, t_skillBox);
SetupEquipBox();
}
 
Search WWH ::




Custom Search