using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class moving : MonoBehaviour {
public GameObject obj;
private float speed = 5f;
private Rigidbody2D rb;
private Vector3 directionY;
private void Awake(){
rb = GetComponent <Rigidbody2D> ();
}
private void Update () {
if (Input.GetKey (KeyCode.W)) {
directionY = transform.up;
transform.position = Vector3.MoveTowards (transform.position + directionY, transform.position,speed * Time.deltaTime);
} else if (Input.GetKey (KeyCode.D)) {
}
}
}