x


Planting a Bomb

Ok now i have a question on how to plant a bomb. I got my bomb picking up script, but now i need help with planting a bomb at a objective. Ok here is my script for picking up the bomb. private var Player : Bomb;

function OnTriggerEnter ( collision : Collision )
{
    Destroy (gameObject);
    if (Player)
    {
        Player = GetComponent(Bomb) += 1;
    }
}

Now i when my player comes up to the objective i want something to display, like to press a button. So for when i press the e button it will plant a bomb. In the spot. And someone can come to defuse it. I know this is 2 questions but you can only answer 1 if you want to. Thank you.

more ▼

asked May 09 '11 at 02:47 AM

Kashaunzilla gravatar image

Kashaunzilla
34 17 19 28

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

For the display, use GUI. You can add a trigger around the objective, and if player is in it, show it, if not, then don't.

Then for planting, if player pushes a button, then put bomb on thing.

For defuse, same thing, just bomb off thing.

Input: http://unity3d.com/support/documentation/ScriptReference/Input.html

GUI: http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html

And looks like you have the trigger =).

more ▼

answered May 09 '11 at 02:53 AM

Justin Warner gravatar image

Justin Warner
6.3k 19 27 65

I would have told you the same thing Justin Warner is right :)

May 09 '11 at 03:19 AM MC HALO

I am already familiar with the input, i want to plant the bomb in its place.

May 16 '11 at 03:25 AM Kashaunzilla
(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:

x26
x3

asked: May 09 '11 at 02:47 AM

Seen: 849 times

Last Updated: May 09 '11 at 02:47 AM