Skip to content
Permalink
614415cb52
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
30 lines (25 sloc) 723 Bytes
using UnityEngine;
using System.Collections;
public class PlayerMovement : MonoBehaviour {
float speed = 4f;
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.D))
{
transform.Translate(Vector2.right * speed * Time.deltaTime);
}
else if (Input.GetKey(KeyCode.A))
{
transform.Translate(-Vector2.right * speed * Time.deltaTime);
}
else if (Input.GetKey(KeyCode.W))
{
transform.Translate(Vector2.up * speed * Time.deltaTime);
}
else if (Input.GetKey(KeyCode.S))
{
transform.Translate(-Vector2.up * speed * Time.deltaTime);
}
}
}