x


Gui for ammos and grenades

hi theres some thing wrong BulletCollisions.Bullet_AMMO--; print("YOU NOW HAVE "+ BulletCollisions.Bullet_AMMO +" Bullets"); } } }

when i out this code it does go up but it doesnt update it self and stays that number.. for example you get 20 grenades and throw 10, it stays at 20 PLEASE HELP

more ▼

asked Apr 08 '10 at 07:06 AM

mebin Skaria gravatar image

mebin Skaria
19 3 3 8

You need to provide more information before someone can help you. There's no way we can understand what you're talking about with such little information.

Apr 08 '10 at 07:58 AM qJake
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Try this script:

var grenades = 20;

function Update () {
    if (Input.GetButton ("Fire1")) {
        grenades --;
        //Put your firing script here.
    }
}

function OnGUI () {
    GUI.Label (Rect (25, 25, 100, 30), "Ammo: " + grenades);
}

Whenever you fire it outputs the amount of ammo you have and updates it on the screen. Note: This does not shoot a projectile. It just keeps track of your ammo.

more ▼

answered Apr 08 '10 at 01:50 PM

e.bonneville gravatar image

e.bonneville
5.7k 100 116 165

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x476

asked: Apr 08 '10 at 07:06 AM

Seen: 623 times

Last Updated: Apr 08 '10 at 07:06 AM