using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
// Movement Variables
public float moveSpeed = 5F;
public float jumpHeight = 5F;
// Input Variables
public KeyCode moveRight = KeyCode.D;
public KeyCode moveLeft = KeyCode.A;
public KeyCode jumpKey = KeyCode.W;
// Component Variables
private Rigidbody2D rigid;
// Update on Scene Start
void Start()
{
rigid = GetComponent<Rigidbody2D>();
}
// Update Per Frame
void Update ()
{
// Move Right
if (Input.GetKey(moveRight))
{
transform.position += Vector3.right * moveSpeed * Time.deltaTime;
}
// Move Left
if (Input.GetKey(moveLeft))
{
transform.position += Vector3.left * moveSpeed * Time.deltaTime;
}
// Jump (Not Working)
if (Input.GetKeyDown(jumpKey))
{
rigid.AddForce(Vector3.up * jumpHeight);
}
}
}