- Home /
How do I get my Ammo Hud on the bottom right of the screen?
function OnGUI ()
{
if (beingHeld)
{
for (var i : int = 1; i <= currentClip; i++)
{
GUI.DrawTexture(Rect(ammoStartX + ((i - 1) * (ammoSize.x + ammoSpacing)), ammoY, ammoSize.x, ammoSize.y), bulletHudTexture);
}
GUI.Label(ammoCountRect, currentClip.ToString() + "/" + currentExtraAmmo.ToString());
}
}
Above is my code so far it displays the bullet at the top left.
Thanks in advance!
Answer by Loius · Sep 27, 2013 at 03:26 AM
The Rect(angle) variables control position and size of those GUI elements; mess with their values.
new Rect(xPositionInPixels, yPosition, widthInPixels, height)
new Rect(Screen.width - elementWidth, Screen.height - elementHeight, elementWidth, elementHeight)
So I add a new line with new Rect(Screen.width - elementWidth, Screen.height - elementHeight, elementWidth, elementHeight)
Or do I mess with the line I have now?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Ammo GUI Display Bottom Right of Screen? 1 Answer
Shooting speed help! 1 Answer
How to add the needed amount to the AmmoCount (current ammo)? 1 Answer
Help with ammo script :) 1 Answer