using System.Collections;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
private Animator anim;
public float SpeedForce;
private Rigidbody2D rb;
private float HorizontalInput;
void Start()
{
rb = GetComponent<Rigidbody2D>();
anim= GetComponent<Animator>();
}
void Update()
{
HorizontalInput = Input.GetAxis("Horizontal");
if (HorizontalInput > 0.01f)
transform.localScale = new Vector2(5,5);
else if (HorizontalInput < -0.01f)
transform.localScale = new Vector2(-5,5);
rb.velocity = new Vector3(HorizontalInput * SpeedForce, rb.velocity.y,0);
anim.SetBool("run", HorizontalInput != 0);
}
}