Hello,
I’m a super beginner and have a very basic maze game. Your player character is controlled by a script known as “tankMovement”. This also contains a public int variable called “count” which counts the tank’s number of pickups collected.
On a separate script, “doorOpen”, which is attached to a parent group consisting of a door and the wall trigger associated with it, I am trying to have an If statement check the value of tankMovement’s “count” integer, and then raise the door up once it hits 5. The “doorOpen” script is below.
using UnityEngine;
using System.Collections;
public class doorOpen : MonoBehaviour {
private tankMovement tankScore;
void Start () {
tankScore = GetComponent<tankMovement> ();
}
void Update () {
if (tankScore.GetComponent<tankMovement>().count==5) {
transform.Translate(new Vector3(0, 1, 0));
}
}
}
I have been getting numerous errors with this all day and it’s hurting my brain trying to fix it. Sorry for being such a beginner but I’d love some advice on how to proceed so I can get on with my learning.