Newbie script c#.
using UnityEngine;
using System.Collections;
public class Moves : MonoBehaviour {
Rigidbody2D Rbot;
private Animator anim;
bool bJump = false;
//this parameter type boolean that has make same with Animator on it,idle & jump.
//“idle” I make make transition to “jump” conditions bJump > true and otherwise.
// Use this for initialization
void Start () {
Rbot = this.GetComponent();
anim = GetComponent ();
}
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.Space)) {
anim.SetBool(“bJump”,true);
}
}
}
Question, when I click play than button space, “Robot2d” that have Script Moves unstop jump, after click space,I think when I click space it enough 1x & Robot2d back to idle. How make it Return to idle?