Hello
So i was watching the project roll a ball, instead of boxes i put coins and changed the game a little
But in these videos it explains how to count score nothing about loading new scenes and stuff
i fugured out by myself (wich is BIG thing) how to load a new scene
i put a cube in the scene and a script like
using UnityEngine;
using System.Collections;
public class LevelLoad : MonoBehaviour {
void OnTriggerEnter(Collider other) {
Application.LoadLevel("Scene2");
}
}
but the score is “counted” or “Stored” in the character script
It looks like this
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
public GUIText countText;
public GUIText winText;
private int count;
void Start ()
{
count = 0;
SetCountText ();
winText.text = "";
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
GetComponent<Rigidbody>().AddForce(movement * speed * Time.deltaTime);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText ();
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString ();
if (count >= 7)
{
winText.text = "You May Now Pass To The Next Level!";
}
}
}
How i do to be Unable to pass to the next level unless you have “7” Score ?
and now that we are here
i have another question
How can i make menu’s and stuff?
If anyone know’s a link to documentation or tutorials for this things or any one knows to answer here
Thanx a lot