|
plsplsplspls helpme im stuck!!!......ok im trying to make a script that when the enemy( a cube)with the tag of "enemy" is shoot and is about to be destroyed a GUI button pops up and asks you a question and if you answer wrong the cube doesnt die but if you answer right the cube destroys ..... i alredy got a character damage script on the cube so when the cube takes 100 damege it gets destroyed...i was thinking to make a script that when a GUI button is pressed it activates another script that destroyes the cube ....like this but this is for distance...i want when about to be destroed if theres no alternative i could use this script so when near the cube the GUI pops up...but pls help me on a destroy "enemy" script...plsplsplsspl
(comments are locked)
|
|
you could just use the Destoy() command? I guess you have a 'if' statement for the GUI.Button,- you could just take the box as a 'Var : GameObject' and then set the 'if' statement to destroy it if the right button is pressed: If you need something more flexible, then you can create Functions: so like this?
Jun 16 '11 at 09:00 AM
darkcookie
Why would you have the entire function if you can just do Destoy(cube,5)? It's the most obsolete function I've ever seen.. :o
Jun 16 '11 at 11:45 AM
Joshua
The idea of the function is too add more functionality- so you can, say- play a sound when the cube gets destroyed- or instaiate another model. Thats what functions are for.
Jun 16 '11 at 03:58 PM
naf456
(comments are locked)
|

the script that would be triggered would be http://pastebin.com/g93Lpxwm
but i would cahnge the Application.LoadLevel(1) to the code to destroy the cube....this was a load levle script but is there a way to change it so i can destroy the cube?
Please don't create multiple questions for the same thing.