using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerController : MonoBehaviour
{
public float movementSpeed;
private float horizontalMovement;
private float verticalMovement;
public float jumpSpeed;
public bool isGrounded;
public bool isJumping;
// Update is called once per frame
void Update()
{
horizontalMovement = Input.GetAxis("Horizontal");
transform.Translate(Vector2.right*horizontalMovement*Time.deltaTime*movementSpeed);
verticalMovement = Input.GetAxis("Jump");
transform.Translate(Vector2.up*verticalMovement*Time.deltaTime*jumpSpeed);
if (horizontalMovement != 0)
{
GetComponent<Animator>().SetBool("isRunning", true);
}
else
{
GetComponent<Animator>().SetBool("isRunning", false);
}
function OnCollisionEnter (col : Collision)
{
if (col.gameObject.tag == "Ground" )
{
SetBool("isGrounded", true);
}
else
{
SetBool("isGrounded", false);
}
}
}
}
I tried to use this code, but it had a “playerController.cs(30,51): error CS1513: } expected”. I counted and i don’t think I am missing anything. What am I doing wrong?