void Move(float h)
{
//prevent player from moving when hidden
if (!hide)
{
// Set movement and normalize in terms of time passed from previous frame
// (Assuming we will be frame rate dependent)
movement.x = h;
movement *= Time.deltaTime;
// apply movement to player
transform.Translate(movement);
if (movement.x != 0)
{
anim.SetBool("Walking", true);
}
else
{
anim.SetBool("Walking", false);
}
//this checks which direction the player is moving and flips the player based upon that
if (movement.x > 0 && facingRight == false)
{
FlipPlayer();
}
if (movement.x < 0 && facingRight == true)
{
FlipPlayer();
}
}
}