- Home /
GuiTexture For Jump A Character
Hello i can make my ball jump well by pressing space button on my keyboard but when i try to change it to GUITexture for android touch doesn't work and give me alot of work this is my script for jumping what should i modify to make it jump by GUITexture ?
pragma strict
ar jumpstrength : float = .3 ; var jumpdecay : float = .01 ; var jumped : boolean = false ;
function Start () {
this.gameObject.AddComponent(Rigidbody) ; this.rigidbody.freezeRotation = true ;
}
function Update () {
if ( this.jumped ) { this.transform.position.y += jumpstrength - jumpdecay ; this.jumpdecay += 0.009 ;
}
}
function LateUpdate () {
if ( Input.GetKeyDown("space") ) {
if (!this.jumped ) { this.jumped = true ; } } }
function OnCollisionEnter ( colision : Collision ) { if ( colision.gameObject.name == "Floor") {
this.jumped= false ; this.jumpdecay = 0.01 ; }
}
Your answer
Follow this Question
Related Questions
The first object in selection grid can't be activated. Why? 1 Answer
Cant get my gui in the quiwindow to load there functions... 1 Answer
How to make rope more flexible? 0 Answers
Temperature Script? 3 Answers
If statement only work once? 1 Answer