I am making my first 2D platformer,
In the game I am trying to add shooting in to the caracter.
Now I am getting stuck with 2 errors:
Assets\ShootController.cs(5,33): error CS1519: Invalid token ‘;’ in class, struct, or interface member declaration
and
Assets\ShootController.cs(5,22): error CS1519: Invalid token ‘=’ in class, struct, or interface member declaration
I am asking for help because I can not find the problem.
here is the code:
using UnityEngine;
public class ShootController : MonoBehaviour {
public float fireRate = 0.2f;
public Transform = FirePoint;
public GameObject bulletPrefab;
float timeUntilfire;
PlayerMovement pm;
private void start()
{
pm = gameObject.GetComponent();
}
private void Update()
{
if (Input.GetMouseButtonDown(0) && timeUntilfire < Time.time)
{
Shoot();
timeUntilfire = Time.time + fireRate;
}
}
void Shoot()
{
float angle = pm.isFacingRight ? 0f : 180f;
Instantiate(bulletPrefab, FirePoint.position, Quaternion.Euler(new Vector3(0f, 0f, angle)));
}
}
I have added the code as a file to.
Please help me,
6604147–751249–ShootController.cs (736 Bytes)