i have finished the spaceShooter tutorial and am trying to flesh it out for fun and increased knowledge. What i am tring to do is increase the speed of the asteroids every 50 points. the mover scripts controls the speed of the asteroids. when they are instanced.
public class mover : MonoBehaviour
{
private int currentSpeed;
void Start ()
{
currentSpeed = GameController.GetComponent(speedSetter);
rigidbody.velocity = transform.forward * currentSpeed;
}
// Update is called once per frame
void Update ()
{
}
}
current speed is controlled in the GameController.
thanks that did help. my code compiles now which is a big step forward. however the asteroids no longer move. for some reason the speedSetter seems to be 0.
here is the mover() code
public class mover : MonoBehaviour
{
private int currentSpeed;
GameController gamecontroller;
// Use this for initialization
void Start()
{
gamecontroller = GetComponent<GameController>();
currentSpeed = gamecontroller.speedSetter();
rigidbody.velocity = transform.forward * currentSpeed;
}
}
and here is the speedSetter() code on the GameController