Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------------------------------
- // Starts the GunGame HUD.
- //---------------------------------------------------------------------------------------------------
- function GunHUD()
- {
- /* Add option for No HUD */
- self.MainShader = createRectangle("CENTER", "", 400, 360, 50, 60, (0, 0, 0), "black", 1, 1); /* Main Gun Shader */
- self.nextweap = createText("objective", 0.2, "CENTER", "", 415, 375, 1, 1, (0, 0, 0), "Next Weapon:"); /* Next Weapon String */
- //self.nextweapicon = createRectangle("CENTER", "" 410, 382, 30, 35, (1, 1, 1), "t7_zm_chalk_buy_" + level.gunname[0] ); /* Gun Icon */
- thread ProgressCalc();
- }
- //---------------------------------------------------------------------------------------------------
- // Calculates progress towards next weapon.
- //---------------------------------------------------------------------------------------------------
- function ProgressCalc()
- {
- self endon("death");
- self.ProcessBar = hud::createBar( (0,0,0), 400, 150 ); //createPrimaryProgressBar(); could be used + would be in center screen, but for now.
- while(1)
- {
- /* Start of Thread */
- if(self.score != level.weaponPointArray[0])
- self.ProcessBar hud::updateBar((self.score * 10) / 2000);
- else if(self.score >= level.weaponPointArray[0] && self.score != level.weaponPointArray[1])
- self.ProcessBar hud::updateBar((self.score * 10) / 3000);
- else if(self.score >= level.weaponPointArray[3] && self.score != level.weaponPointArray[4])
- self.ProcessBar hud::updateBar((self.score * 10) / 4000);
- else if(self.score >= level.weaponPointArray[4] && self.score != level.weaponPointArray[5])
- self.ProcessBar hud::updateBar((self.score * 10) / 5000);
- else if(self.score >= level.weaponPointArray[5] && self.score != level.weaponPointArray[8])
- self.ProcessBar hud::updateBar((self.score * 10) / 6000);
- else if(self.score >= level.weaponPointArray[8] && self.score != level.weaponPointArray[10])
- self.ProcessBar hud::updateBar((self.score * 10) / 7000);
- else if(self.score >= level.weaponPointArray[10] && self.score != level.weaponPointArray[12])
- self.ProcessBar hud::updateBar((self.score * 10) / 50000);
- /* Start of Position */
- self.ProcessBar hud::setPoint("CENTER", undefined, 0, 295);
- self.ProcessBar.color = (0, 0, 0);
- self.ProcessBar.bar.color = (184/255, 187/255, 12/255);
- self.ProcessBar.alpha = 1;
- /* Wait */
- wait(0.05);
- }
- }
- //---------------------------------------------------------------------------------------------------
- // Create Text Hud Elem.
- //---------------------------------------------------------------------------------------------------
- function createText(font, fontScale, align, relative, x, y, sort, alpha, glow, text)
- {
- textElem = newClientHudElem(self);
- textElem.sort = sort;
- textElem.alpha = alpha;
- textElem.x = x;
- textElem.y = y;
- textElem.glowColor = glow;
- textElem.glowAlpha = 1;
- textElem.fontScale = fontScale;
- textElem setText(text);
- return textElem;
- }
- //---------------------------------------------------------------------------------------------------
- // Creates Rectangle Hud Elem.
- //---------------------------------------------------------------------------------------------------
- function createRectangle(align, relative, x, y, width, height, color, shader, sort, alpha)
- {
- boxElem = newClientHudElem(self);
- boxElem.elemType = "bar";
- if(!level.splitScreen)
- {
- boxElem.x = -2;
- boxElem.y = -2;
- }
- boxElem.width = width;
- boxElem.height = height;
- boxElem.align = align;
- boxElem.relative = relative;
- boxElem.xOffset = 0;
- boxElem.yOffset = 0;
- boxElem.children = [];
- boxElem.sort = sort;
- boxElem.color = color;
- boxElem.alpha = alpha;
- boxElem setShader(shader, width, height);
- boxElem.hidden = false;
- boxElem.x = x;
- boxElem.y = y;
- boxElem.alignX = align;
- boxElem.alignY = relative;
- return boxElem;
- }
Advertisement
Add Comment
Please, Sign In to add comment