Hello guys! To let me get started, a friend and I are designing a simple game as kind of a learning experience/for fun. Its kind of going to be a FPS/RPG. I went through the FPS tutorial and found it great!! I have a little programming experience, but not much (HTML/CSS/PHP/MySQL), but i learn very quickly!. Now here is where i ran into trouble. I managed to make a box that when you approach the cube, it asks you "How are you today? What can i do for you?" after watching a tutorial on youtube, but now im confused as to how you would make a response to that? Here is my current code "Display GUI Script".
var target : Transform;
function Update () {
var other = gameObject.GetComponent("GUI Style Script");
if ( Vector3.Distance(target.position, transform.position ) < 25) {
other.enabled = true;
}
if ( Vector3.Distance(target.position, transform.position ) > 25) {
other.enabled = false;
}
}
and here is my GUI Style Scripting.
var Dialogue = 0;
function OnGUI () {
// Make a background box
if ( Dialogue = 0 ) {
GUI.Box (Rect (10,10,300,90), "Why hello there! What can i do for you?");
}
if (GUI.Button (Rect (20,40,80,20), "Nothing")) {
}
}
Now this is probably the totally wrong approach, but i thought maybe I could have my "if" statement change the amount dialogue, to make a different response... xD (Yes, this code does generate an error)
Does anyone know of a tutorial that goes through this? or even just a beginners tutorial on GUI?
Thanks guys!! I'm hoping that someday I'll be able to give back the the community!!