Question by
jojan5 · Jan 04, 2018 at 08:17 PM ·
c#unity 5scripting problemerror
tengo un problema con este script no puedo hacer que salte el personaje en un 2f,hi i have a problem making my chacter jump with this script
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Girlinput : MonoBehaviour {
//* public float chacterspeed; public float jumpspeed; public Transform marca; public LayerMask whatisground;
private Rigidbody2D cuerpo;
private Vector2 movement;
private float movhor;
private bool movver;
private bool inground;
// **************************************************************************
void Start()
{
this.cuerpo = this.GetComponent<Rigidbody2D>();
this.movement = new Vector2();
this.inground = false;
}
// void Update() { this.movhor = Input.GetAxis("Horizontal"); this.movver = Input.GetKey(KeyCode.Space); if (Physics2D.OverlapCircle(this.marca.position,0.02f,this.whatisground)) { this.inground = true; } else { this.inground = false; } }
// void FixedUpdate() { if (this.movver && this.inground) { this.movement.y = jumpspeed; } if (!this.inground) { if(this.movement.y < -7) { this.movement.y = -7;
} }
this.movement = this.cuerpo.velocity;
this.movement.x = movhor * chacterspeed;
this.cuerpo.velocity = this.movement;
}
}
Comment