Top Down View Player Movement
//Simple top down view player movement ( ̄︶ ̄)↗
//src-Brackeys(yt)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float speed = 10f;
public Rigidbody2D rb;
Vector2 movement;
void Update()
{
//Input
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}
void FixedUpdate()
{
//Movement
rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime);
}
}
Abdur Rafay