Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

No se mueve mi personaje

Discussion in 'Scripting' started by hectorsinmas25, Apr 11, 2020.

  1. hectorsinmas25

    hectorsinmas25

    Joined:
    Apr 11, 2020
    Posts:
    1
    He echo el siguiente scrip:


    Para que se mueva mi personaje,pero no se mueve si alguien sabe el error por favor que me lo diga .

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Control : MonoBehaviour {
    5.  
    6.  
    7.     public float alturasalto;
    8.  
    9.  
    10.     public float velocidadMovimiento;
    11.  
    12.  
    13.     void Start() {
    14.  
    15.     }
    16.  
    17.  
    18.     void update()
    19.     {
    20.  
    21.  
    22.        
    23.         if (Input.GetKeyDown (KeyCode.Space))
    24.         {
    25.             GetComponent<Rigidbody2D> ().velocity = new Vector2 (GetComponent<Rigidbody2D> ().velocity.x, alturasalto);
    26.         }
    27.  
    28.  
    29.         if (Input.GetKey(KeyCode.D))
    30.         {
    31.             GetComponent<Rigidbody2D> ().velocity = new Vector2 (velocidadMovimiento, GetComponent<Rigidbody2D> ().velocity.y);
    32.         }
    33.  
    34.  
    35.         if (Input.GetKey(KeyCode.A))
    36.         {
    37.             GetComponent<Rigidbody2D> ().velocity = new Vector2 (-velocidadMovimiento, GetComponent<Rigidbody2D> ().velocity.y);
    38.         }
    39.     }
    40. }
     
  2. ender0074

    ender0074

    Joined:
    Aug 24, 2020
    Posts:
    1
    encontraste una solución?
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    update()
    ->
    Update()