Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - frighten98

#1
General (Antiguo) / Necesaria ayuda con Javascript
Junio 24, 2016, 11:55:01 PM
Si, en efecto se solucionó el problema, ahora mismo estoy añadiendo mas  "chorradas", estoy haciendo un pequeño menu de respawn, bueno mas bien hacer que aparezca cuando la salud esté en 0 o por debajo de 0.
 
Se que hay muchos scripts en la web, pero si lo hago yo aunque me ayuden, me sentiré orgulloso.
 
Muchas gracias por la ayuda, si necesito algo mas contestare este post o abriré uno nuevo.
#2
General (Antiguo) / Necesaria ayuda con Javascript
Junio 24, 2016, 08:25:35 PM
Hola a todos, me llamo Javi y estoy teniendo un pequeño problema con un script, concretamente con un if, adjunto una imagen.
 
Probablemente sea uno de mis grandes fallos tontos, pero ahí mismo lo teneis.
 

(inserto también el script)
var curHealth : int = 100;
var maxHealth : int = 100;
var healthtext : GUIText;
var regenActive;
var isNotDead=true;
 
function Update () {
 
    healthtext.text = curHealth + "%";
 
    if(curHealth < ) {
        curHealth = ;
    }
 
    if(curHealth > 100) {
        curHealth = 100;
    }
 
    if(Input.GetKeyDown("e")) {
        curHealth -= 10;
    }
}
function OnTriggerEnter(other : Collider){
    if (other.tag == "DeadZone"){
        curHealth -= 500;
        isNotDead= false;}
    if (curHealth < 100 || (other.tag == "PickHealth")){
        curHealth += 50;}
    if (other.tag == "Fire"){
        curHealth -= 10;}
}
    function Start () {
        if isNotDead=false; {
            Destroy(gameObject);
        }
    }

 
#3
[quote author=Rouless" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="15773" data-ipsquote-contentcommentid="100702 date=1437743268]Estos graficos los haces mediante programacion o los has modelado? Es curiosidad.... [/quote]Mediante programacion 
#4
[quote author=diogenes64" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="15773" data-ipsquote-contentcommentid="100617">ahora Si
#5
[quote author=diogenes64" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="15773" data-ipsquote-contentcommentid="100613">este el nuevo move.cs[/quote]
#6
[quote author=MatiasBoyer" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="15773" data-ipsquote-contentcommentid="100609">Es porque estás usando el Cursor.lockState de mala manera.
http://docs.unity3d.com/ScriptReference/Cursor-lockState.html date=1437606546]http://docs.unity3d.com/ScriptReference/Cursor-lockState.html

Según lo que entiendo, con Cursor.visible ya basta[/quote]pero lo que necesito es que se bloquee el cursor en el centro , ya que por ejemplo al jugar en modo ventana , el cursor se sale del juego 
[quote author=diogenes64" data-ipsquote-contapp="forums" data-ipsquote-contenttype="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentid="15773" data-ipsquote-contentcommentid="100610"> using UnityEngine;
using System.Collections;public class move : MonoBehaviour {    public float deltaRotation = 30f;
    public float deltaMovement = 10f;    // Use this for initialization
    void Start () 
    {    }
    
    // Update is called once per frame
    void Update () 
    {
        Rotate ();
        Movement ();
    }    void Rotate ()
    {
        if(Input.GetKey(KeyCode.Q))    
            transform.Rotate(new Vector3 (0f, -deltaRotation, 0f) * Time.deltaTime);
         else if(Input.GetKey(KeyCode.E))    
            transform.Rotate(new Vector3 (0f, deltaRotation, 0f) * Time.deltaTime);
    
    }    void Movement (){
        if(Input.GetKey(KeyCode.W))
            transform.Translate(Vector3.forward * deltaMovement * Time.deltaTime);
        else if(Input.GetKey(KeyCode.S))
            transform.Translate(Vector3.back * deltaMovement * Time.deltaTime);
        else if(Input.GetKey(KeyCode.A))
            transform.Translate(Vector3.left * deltaMovement * Time.deltaTime);
        else if(Input.GetKey(KeyCode.D))
            transform.Translate(Vector3.right * deltaMovement * Time.deltaTime);
    }
} como ves }
function Update(){
    
    if(Input.GetKeyDown(KeyCode.P)){
        
        Cursor.visible = true;
        Cursor.lockState = false;
        
    }
}
    
#7
Soy principiante en cuanto a programación se trata , y estoy recibiendo el error del título en el siguiente script : function OnGUI(){    if(Input.GetKeyDown(KeyCode.O)){
    
        Cursor.visible = false;
        Cursor.lockState = true;        
    }
    GUI.Box(Rect(Screen.width-300,0,300,20), "Press P/O To show/hide Cursor");
}
function Update(){    if(Input.GetKeyDown(KeyCode.P)){
    
        Cursor.visible = true;
        Cursor.lockState = false;
            
    }}Y no se de que clase de error se trata , lo siento si me equivoqué de categoría  .PD: Uso Unity 5