using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovement : MonoBehaviour {
Rigidbody2D rbody;
Animator animated;
// Use this for initialization
void Start () {
rbody.GetComponent<Rigidbody2D>();
animated.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
if (movement_vector != Vector2.zero)
{
animated.SetBool("isrunning", true);
animated.SetFloat("input_x", movement_vector.x);
animated.SetFloat("input_y", movement_vector.y);
}
else {
animated.SetBool("isrunning", false);
}
rbody.MovePosition(rbody.position + movement_vector * Time.deltaTime);
}
}