Unity Spain
Post Antiguos => General (Antiguo) => Mensaje iniciado por: neker92 en Enero 07, 2016, 04:24:07 AM
Hola como hago para que muestre los puntos ganados en otra opción de MEJOR PUNTUACIÓN , el script que tengo solo esta guardando y cada vez que recoge monedas va sumando y no quiero eso. Energía = Puntos-----------------------{ int maxin;
int contador;
public Text puntuacion;
public Text Manxi; public void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Bateria")
{
Destroy(other.gameObject);
contador = contador + 1;
puntuacion.text = "Energia: " + contador; PlayerPrefs.SetInt("Energia", contador); } } void Start() { PlayerPrefs.GetInt("Energia", maxin);
contador = PlayerPrefs.GetInt("Energia");
}
}
int maxin;
int contador;
public Text puntuacion;
public Text Manxi; public Text puntuacionmaxima; public void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.tag == "Bateria")
{
Destroy(other.gameObject);
contador = contador + 1;
if(puntuacion > puntuacionmaxima){ PlayerPrefs.SetInt("Energia", puntuacionmaxima); } puntuacion.text = "Puntuacion : "+ contador; puntuacionmaxima.text = "/Puntuacionmaxima: "+ "energia"; } void Start() { PlayerPrefs.GetInt("Energia", maxin);
contador = PlayerPrefs.GetInt("Energia");
}
} Lo que entiendo es que quieres que muestre una puntacion actual y una puntuacion maxima.El código que escribi puede tener error de sintaxis.
HOLA
DavidV, te agradezco por tu aporte ya que me hizo de gran ayudaaa!! Solo cambie algunas variables y funcionó perfectamente... Gracias....