I am trying to make a sprite move but when i tried to implement my code it came up with the cs0619 error . How can I fix it?
My code:
using UnityEngine;
using System.Collections;
public class Player : Entities {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.W))
{
rigidbody2D.transform.position += Vector3.up * speed * Time.deltaTime;
}
if(Input.GetKey(KeyCode.S))
{
rigidbody2D.transform.position += Vector3.down * speed * Time.deltaTime;
}
if(Input.GetKey(KeyCode.A))
{
rigidbody2D.transform.position += Vector3.left * speed * Time.deltaTime;
}
if(Input.GetKey(KeyCode.D))
{
rigidbody2D.transform.position += Vector3.down * speed * Time.deltaTime;
}
}
}