hi everyone. please go easy on me. this is my FIRST attempt at using C#. i’m not sitting here claiming to know anything about it; i’m simply following the steps in a book.
can you please EXPLAIN my error as if i’m an idiot please. i feel as if i have typed it in exactly as the book has told me to but i get a parsing error message when attempting to play.
here is the code as i typed it in:
using UnityEngine;
using System.Collections;
public class Shooter : MonoBehaviour {
public Rigidbody bullet;
public float power = 1500f;
public float moveSpeed = 2f;
void Update () {
float h = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
float v = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
transform.Translate(h, v, 0);
if (Input.GetButtonUp ("Fire1")){
Rigidbody instance = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
Vector3 fwd = transform.TransformDirection(Vector3.forward);
Instance.addforce(fwd * power);
}
}