I was watching a Youtube video on making a Platfomer Game and I was writing a Jump and move left and Right code. I also DID ever thing he told me to but, I got a ***BUNCH*** of error and I don't know how to fix it. Please Help, here is the code below
--------------------------------------------------------------------------------------
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
//Movement
public float speed;
public float jump;
float moveVelocity;
//Grounded Vars
bool grounded = true;
void Update ()
{
//Jumping
if(Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.W)
)
if (grounded)
GetComponent ().velocity = new Vector2(GetComponent().velocity.x, jump);
}
}
//Left Right Movement
if (Input.GetKey(KeyCode.LeftArrow) || (Input.GetKey(KeyCode.A) )
(
moveVelocity = speed:
)
if (Input.GetKey(KeyCode.RightArrow) || (Input.GetKey(KeyCode.D)
(
moveVelocity = speed
)
}
---------------------------------------------------------------------------------------
Please do help! Thank you!
↧