You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried following the tutorial and i got all the way to the end and when I tested it, it called the jump event both when it originally jumps and when it lands. any ideas?
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour
{
public movementScript ms;
public Animator animator;
public bool jumpAction;
private bool playerStopped;
private float stopTimer;
public float horizontalMovement;
public float runSpeed = 40f;
public bool jump;
public bool crouch;
// Update is called once per frame
void Update()
{
horizontalMovement = Input.GetAxisRaw("Horizontal") * runSpeed;
animator.SetFloat("Speed", Mathf.Abs(horizontalMovement));
if (Input.GetButtonDown("Jump"))
{
jump = true;
animator.SetBool("IsJumping", true);
}
if (Input.GetButtonDown("Crouch"))
{
crouch = true;
} else if (Input.GetButtonUp("Crouch"))
{
crouch = false;
}
if(stopTimer >= 10)
{
animator.SetBool("IsSitting", true);
}
else if(stopTimer < 10)
{
animator.SetBool("IsSitting", false);
}
}
public void OnLanding ()
{
animator.SetBool("IsJumping", false);
Debug.Log("Player Landed");
}
I tried following the tutorial and i got all the way to the end and when I tested it, it called the jump event both when it originally jumps and when it lands. any ideas?
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour
{
public movementScript ms;
public Animator animator;
public bool jumpAction;
private bool playerStopped;
private float stopTimer;
public void OnLanding ()
{
animator.SetBool("IsJumping", false);
Debug.Log("Player Landed");
}
}`
The text was updated successfully, but these errors were encountered: